Debugging Android app stuck at waiting for debugger

Viewed 229

Problem description

I'm debugging an app by gdb remote. Actually I did following steps:

  1. start the app with Developer options -> Wait for debugger enabled
  2. gdbserver :5039 --attach ${pid of the app process}
  3. adb forward tcp:5039 tcp:5039
  4. gdb --> target remote :5039

after doing that, gdb console print:

// skip
Reading symbols from target:/system/lib64/libwebviewchromium_loader.so...
Reading symbols from .gnu_debugdata for target:/system/lib64/libwebviewchromium_loader.so...
(No debugging symbols found in .gnu_debugdata for target:/system/lib64/libwebviewchromium_loader.so)
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Thread 1 "com.example.uiapp" stopped.
0x00000077c6f7a26c in syscall () from target:/system/lib64/libc.so
2: x/5i $pc
=> 0x77c6f7a26c <syscall+28>:   svc     #0x0
   0x77c6f7a270 <syscall+32>:   cmn     x0, #0x1, lsl #12
   0x77c6f7a274 <syscall+36>:   cneg    x0, x0, hi  // hi = pmore
   0x77c6f7a278 <syscall+40>:   b.hi    0x77c6fd5c3c <__set_errno_internal>  // b.pmore
   0x77c6f7a27c <syscall+44>:   ret

and the gdbserver print:

aphael:/ $ run-as com.example.uiapp /data/data/com.example.uiapp/gdbserver :5039 --attach 13229                                                                                                                       
Attached; pid = 13229
Listening on port 5039
Remote debugging from host 127.0.0.1, port 46297

but the app still stuck at Waiting for Debugger, even if I execute continue in gdb.

Question

  1. Did I miss any steps in debugging, which caused this problem?
  2. if I start app with Developer options -> Wait for debugger disabled, gdb can attach the app process, and the debugging is correct. But I want to debug immediately when the app starts, so how can I solve this problem?

Remark

I didn't use Android Studio with lldb debugger, because lldb has weird bug when debugging my app.

Thank you for looking at my question, any discussions are welcome.

0 Answers
Related