Linux: How to debug a SIGSEGV? How do I trace the error source?

后端 未结 2 1112
执念已碎
执念已碎 2021-02-08 10:04

My firefox started crashing since today. I haven\'t changed anything on the system or on firefox config.

I use
strace -ff -o dumpfile.txt firefox

2条回答
  •  攒了一身酷
    2021-02-08 10:44

    Ivan, your real question is "how do I debug a SIGSEGV?"

    strace is rarely a good help here. SIGSEGV means that the application tried to dereference (access) a location in memory which which hasn't been allocated (or not allowed to be dereferenced for various other reasons). Chances are high that it is not related to the system calls activity which strace is capturing. In order to discover the cause of your crash, start by understanding what address is being dereferenced and what function tries to do that. Debugger is the right tool for this task.

    Here's what you need to do:

     gdb  
    

    in there, analyzing the last executed instruction and using "info registers" you'll see the address in question. Using the "bt" command you'll see the callstack. By walking the callstack up, you'll discover how the incorrect address is being calculated. One of the steps involved in this address calculation is the cause of your problem.

    Debugging is fun and this is a good opportunity to delve into it. A good book or some online articles can help you there. Google away and good luck!

提交回复
热议问题