Mobile/Fennec/Android/GDB: Difference between revisions

JimDB is no longer used. So add link to GV debugging document
(Add instruction to get newer gdbserver binary which works on Android Lollipop)
(JimDB is no longer used. So add link to GV debugging document)
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
= Deprecated =
This page is the information of deprecated debugging tools.  We recommend to use Android studio (https://mozilla.github.io/geckoview/tutorials/native-debugging.html).
= What JimDB? =
JimDB is a fork of GDB used for simplifying Fennec development. It consists of two parts:
JimDB is a fork of GDB used for simplifying Fennec development. It consists of two parts:


Line 7: Line 12:


= Getting started =
= Getting started =
== Using mach ==
You can use mach to fetch, install, configure, and run JimDB with one simple command. Note that if you are on OS X, mach may install JimDB correctly, but then try to debug using lldb. If that happens, you can still run JimDB manually from your ~/.mozbuild folder (you can find the full path in the output below).
  $ ./mach run --debug
  JimDB (arm) not found: /home/gbrown/.mozbuild/android-device/jimdb-arm does not exist
  Download and setup JimDB (arm)? (Y/n) y
  Installing JimDB (linux64/arm). This may take a while...
  From https://github.com/darchons/android-gdbutils
  * [new branch]      master    -> origin/master
  * [new tag]        gdbutils-2 -> gdbutils-2
  * [new tag]        initial-release -> initial-release
  1:45.57 /home/gbrown/.mozbuild/android-device/jimdb-arm/bin/gdb -q --args
  Fennec GDB utilities
    (see utils/gdbinit and utils/gdbinit.local on how to configure settings)
  1. Debug Fennec (default)
  2. Debug Fennec with env vars and args
  3. Debug using jdb
  4. Debug content Mochitest
  5. Debug compiled-code unit test
  6. Debug Fennec with pid
  Enter option from above: 1
  New ADB device is "emulator-5554"
  Using device emulator-5554
  Using object directory: /home/gbrown/objdirs/droid
  Set sysroot to "/home/gbrown/.mozbuild/android-device/jimdb-arm/lib/emulator-5554".
  Updated solib-search-path.
  Ignoring BHM signal.
  Using package org.mozilla.fennec_gbrown.
  Launching org.mozilla.fennec_gbrown... Done
  Attaching to pid 674... Done
  Setting up remote debugging... Done
  Ready. Use "continue" to resume execution.
  : No such file or directory.
  (gdb)


== Using pre-built binaries ==
== Using pre-built binaries ==
Line 25: Line 66:
  cd $HOME
  cd $HOME
  wget https://people.mozilla.org/~nchen/jimdb/jimdb-arm-linux_x64.tar.bz2 # step 1
  wget https://people.mozilla.org/~nchen/jimdb/jimdb-arm-linux_x64.tar.bz2 # step 1
  tar -xf jimdb-arm-linux_x64.tar.bz2 # step 2
  tar -xf jimdb-arm-linux_x64.tar.bz2 # step 3
  cd jimdb/utils # step 3
  cd jimdb-arm/utils && git pull # step 5
git pull
  ../bin/gdb # step 6
  ../bin/gdb # step 4
  sudo ln -s $HOME/jimdb-arm/bin/gdb /usr/bin/jimdb # step 7
  sudo ln -s $HOME/jimdb/bin/gdb /usr/bin/jimdb # step 5


If you download the wrong x86 or x64 build, you might get an error like:
If you download the wrong x86 or x64 build, you might get an error like:
Line 262: Line 302:


You are probably trying to run the x86 version on an ARM device. Download the ARM version of JimDB instead.
You are probably trying to run the x86 version on an ARM device. Download the ARM version of JimDB instead.
Alternatively, you may just have an out-of-date version of gdbserver. Check for an updated version in the link posted above.
    "gdbserver" output:
    error: only position independent executables (PIE) are supported.
This means your build of gdbserver is too old for the Android version you're debugging on. You may need a newer platform sysroot and/or to add flags to gdb/gdbserver/Makefile to build a position-independent executable.
    CFLAGS += -fvisibility=default -fPIE
    LDFLAGS += -rdynamic -fPIE -pie


=== JimDB sucks! Halp!! ===
=== JimDB sucks! Halp!! ===
Line 269: Line 319:
=== JimDB is awesome now!! Can I buy you a $beverage? ===
=== JimDB is awesome now!! Can I buy you a $beverage? ===
Yes! See also {{bug|800000}}
Yes! See also {{bug|800000}}
=== Using `next` to traverse a function sometimes gets stuck with an error like "Unable to find end of function" ===
Try using the env-var MOZ_LINKER_ONDEMAND=0.
=== Execution pauses often for "Program received signal SIG33, Real-time event 33." ===
This should be caught automatically, but try:
    handle SIG33 pass nostop noprint
=== "Symbol not found: __PyErr_ReplaceException" ===
You should not use python 2.7.11.
See : https://github.com/conda/conda/issues/1367
Confirmed users
14

edits