I've recently found, that my instance of TorBrowser crashes on "reddit.com".
I've tried to find any *.log file, like notice.log
or debug.log
. Nothing!
How can I DEBUG browser? To be sure what exactly was a reason of a crash.
Tor Stack Exchange is a question and answer site for researchers, developers, and users of Tor. It only takes a minute to sign up.
Sign up to join this communityThere is an entire chunk of the wiki dedicated to this subject.
Have a read of Debugging the Tor Browser.
(These are all either internal to Firefox or Linux/UNIX specific...I've no idea how you'd even approach this on lesser operating systems? Windows Event Logs and windbg? Can they reach the output of the extensions or firefox's logs to stderr
in any way?)
If you're having issues with a website and want to figure out why it's not loading properly, then you want to use Firefox's built-in Developer Console, this can be activated by navigating from the pull down menu at the top Tools
-> Web Developer
-> Toggle Tools
or using the Ctrl
+Shift
+i
key combination.
This will present you with a few tabs of various tools, the most useful are:
This allows you to view the currently rendered content. Unlike View Source
this is the content as it has been interpreted, and after it may have been altered by any javascript executing in the context of the page. You can also edit or entirely delete sections of the page through this tool.
This is a javascript console, it will contain any errors encountered when processing content on the page. This is also where console.log()
will be output to. You can use this to execute javascript in the context of the page.
This lets you watch network requests being made by the page, this can be handy for discovering if certain resources included by the page are failing to be fetched due to some error, it also allows you to manipulate and resend requests.
If you're having connectivity issues with Tor, then you can go into the Tor Button (Onion) menu and select Tor Network Settings
, then Copy Tor Log To Clipboard
. You can then paste the Tor log into a text editor to review it, or into a site like https://paste.debian.net to share it with others for them to review.
You should note that if you are using private bridges their addresses may appear unredacted in these logs and you should take steps to redact them manually.
The Tor Browser addons (Tor Button and Tor Launcher being the main candidates) have logging functionality with configurable levels of log output. You can edit these through the about:config
page on Tor Browser.
For Tor Button, the numeric value at extensions.torbutton.loglevel
defines how detailed the logs are and similarly for extensions.torlauncher.loglevel
for Tor Launcher.
Valid values are 1 through 5 (inclusive), with 1 being the most detailed and 5 being the lest, are defined as 1 - VERBOSE
, 2 - DEBUG
, 3 - INFO
, 4 - NOTICE
, 5 - WARNING
.
To access the output, you should run run Tor Browser from the command line using the bash script (is there a windows or osx equivalent?) with either the --debug
option set, which will write the output directly to the console or --log
to write them to file. --log
logs them to tor-browser.log
by default, in the top level of the Tor Browser directory, but this can be manually set through an optional argument, for example ./tor-browser_en-US/Browser/start-tor-browser --log /home/user/mylog.log
.
If the firefox
process for Tor Browser is crashing, on Linux you can run the command ulimit -c unlimited
before running it manually from the command line, as outlined in the previous section. This will allow you to generate a coredump of the process if it crashes, this will preserve it's current state and allow you to use binary debugging tools like gdb
to view the state of the process during it's crash. How and where a coredump is stored is defined by a sysctl value in the kernel. You can check this value by running sysctl kernel.core_pattern
, editing it requires root (for obvious reasons). Traditionally it just dumps to a file called core
in $PWD
.
First, to make things easier you will want to retrieve the debugging symbols, since these can be bulky, Tor Browser ships without them by default to conserve space. They are available as a separate download in at the Tor Projects distribution storage website. The file is named tor-browser-linux$ARCH-debug.zip
, where $ARCH is wither 32 or 64, depending on your processor architecture, they also have a corresponding signature which you should verify before use.
Once downloaded, move into the tor-browser_en-US
directory and extract the contents and move the Debug/Browser
folder contained inside to Browser/.debug
. gdb
should now be able to load the symbols required to debug Tor Browser. Now you're ready to debug, load up gdb by running, for example gdb --core Browser/core Browser/firefox
. You can then use gdb to debug the crash and view human-readable function names and other debugging information.