のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

b2g(FirefoxOS) run_gdb.sh attach pid の実行

 $ adb shell b2g-ps
 * daemon not running. starting it now on port 5037 *
 * daemon started successfully *
 APPLICATION      USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
 b2g              root      1472  1     226084 100056 ffffffff 40044140 S  /system/b2g/b2g 
 Usage            app_1591  1591  1472  93620  40608 ffffffff 40072140 S /system/b2g/plugin-container
 Homescreen       app_1602  1602  1472  97720  42316 ffffffff 400d9140 S /system/b2g/plugin-container

または、

$ adb shell ps | grep b2g
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      43    1     161848 51560 ffffffff 4002d360 S /system/b2g/b2g
$ ./run-gdb.sh attach 43

gdbをdddに変えると、dddが起動する。

./run-ddd.sh attach 43

Attached; pid = 43
Listening on port 11043
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gdb -x /tmp/b2g.gdbinit.m_fujii /home/m_fujii/B2G_emu/B2G/objdir-gecko/dist/bin/b2g
GNU gdb (GDB) 7.1-android-gg2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-linux-gnu --target=arm-elf-linux".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/m_fujii/B2G_emu/B2G/objdir-gecko/dist/bin/b2g...done.
Remote debugging from host 127.0.0.1
syscall () at bionic/libc/arch-arm/bionic/syscall.S:50
50	    ldmfd   sp!, {r4, r5, r6, r7}
(gdb) list
45	    mov     r0, r1
46	    mov     r1, r2
47	    mov     r2, r3
48	    ldmfd	ip, {r3, r4, r5, r6}
49	    swi     #0
50	    ldmfd   sp!, {r4, r5, r6, r7}
51	    movs    r0, r0
52	    bxpl    lr
53	    b       __set_syscall_errno
54	

Debugging B2G using gdb - Mozilla | MDN