I also noticed that any fprintf statements that I write in gfx folder (like inside angle or skia), it never gets printed. I am guessing that it's because, it doesn't get compiled again and again and I feel, that would be where data might be going inside to the GPU (If I think of it as a layer structure with WebGL at the top, ANGEL in the middle and GPU in the bottom). So, I would like to know how to open this up and look at the inner details involving ANGEL and GPU.

Regards, 

On Tue, Jun 25, 2019 at 5:13 PM Rishabh Raj <rishabhstpaul@gmail.com> wrote:
Hello everyone,

I am working on making some changes to the WebGL part of Tor Browser's source code. But each WebGL API goes through multiple files and functions in the browser's source code. So, before I can start changing them, I would need to know how exactly the transfer of data takes place. To be more clear, I start with a program which draws a rectangle (vertices have different colors, so interpolation takes place). Take for example the function `bufferData()`, which sends the data to the GPU. Once the shader code or vertices/indices data is sent to the GPU, I am helpless, isn't it? I need to be able to hook before this and analyze the various function calls in different source code files and the data parameters that are circulating through (of course it is not just one API, but a whole bunch of JavaScript API's that have to be executed before something is drawn).

So, how do I figure this out? Initially, I had tried using a bunch of fprintf's, but I always get lost after, say `fBufferData()` [I noticed that many `API()` end up with `fAPI()` in the source code]. In addition, I couldn't figure out when the ANGLE part comes into the picture since I tried putting fprintf's in there as well, but nothing got printed. Basically I am trying to find the right place to hook, just after all calculations on the data are done and before the control is sent to the GPU. So, do I have to attach a debugger, say gdb, to a running instance of tor-browser (incidentally, there are three processes that commence when tor browser is run). Basically, I need some help figuring out how to put all of this together. I would really appreciate if you could provide me with some suggestions.

Warm Regards,
Rishabh