简体   繁体   中英

Printf to Console on Firefox Build

I'm pretty new to Firefox development. I am doing some experimentation and want to be able to print information to the console after I've built and run Firefox.

I"ve added printf statements (and I've tried cout as well) and the relevant #includes to several different files. I've mostly added them to functions in the DOM, but also a few in other parts of the code just to see if I can get something to print out. However, I've never managed to get anything to print. I do everything essentially the same as I would in any other C++ program.

I build and run FF by following these instructions ( https://developer.mozilla.org/en-US/d.. .) and it compiles fine.

Is there something I'm missing? Why am I unable to get printf's to display in the terminal? I'm expecting them to appear in the terminal where I run "mach run".

Edit: I just discovered mochitest. When I run "mach mochitest", my printfs display, in addition to all of the typical printouts for the tests. This is moving me in the right direction, but I still would like to know how to enable those printfs during normal execution of the browser.

Edit 2: Working Link: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build

Windows is "special".

You can run with the -console switch to get an ugly cmd window that contains the dump() and printf() output. This seems to currently be broken .

Or you can use the -attach-console switch to make output go to whatever commandline thing you run Firefox from. Note that -attach-console seems to work on my machine, but --attach-console doesn't...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM