简体   繁体   中英

using continue in LLDB stops the process and throws a SIGSEGV

I'm trying to debug a native C++ App that is crashing using lldb

I also have a sleep(5) at the start of android_main so that I can attach to my app in that time, if that matters

After attaching the app is paused/stopped. So, I use continue

But the process is immediately stopped after using continue and throws a SIGSEGV

(lldb) continue
Process 4158 resuming
Process 4158 stopped
* thread #19, name = 'com.example.app', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #0: 0x00007cefe26282c8
->  0x7cefe26282c8: movq   (%rcx), %rdx
    0x7cefe26282cb: movq   %rdx, 0x18a0(%rax)
    0x7cefe26282d2: movl   0x8(%rcx), %ecx
    0x7cefe26282d5: movl   %ecx, 0x18a8(%rax)

After another continue , the app just exits/crashes

(lldb) continue
Process 4158 exited with status = 11 (0x0000000b)

How do I fix this and just continue execution as normal?

Your app crashed because the register rcx was supposed to hold the address of some object, but in fact held a value that was not in readable memory. That's what SIGSEGV means - a request was made to access memory that couldn't be fulfilled. You can't "continue execution as normal" since the program didn't get some data it needs, so it doesn't have a way to move forward. If you knew the value that SHOULD have been in rcx , you could set rcx to the right value, and then continue. But what you really have to do is figure out why that value was bad, fix the code, rebuild and rerun.

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