Re: How to dump more info when received a SIGSEGV signal?



"cyril.li@xxxxxxxxx" <cyril.li@xxxxxxxxx> writes:

> However the result is not expected, e.g. the eip is not the the fault
> instruction when I use objdump to see the binary.

The ctx is filled only when you *do not* specify SA_SIGINFO.

When you do specify it, you get a single siginfo_t* as an argument
instead (so your program as-written just reads random garbage off
the stack).

> m.sa_flags = SA_SIGINFO;

Make that 'm.sa_flags = 0;' and try again.

Note that you are using undocumented and non-portable kernel feature.
You'll be better off using SA_SIGINFO and the resulting siginfo_t*,
which is still not very portable, but at least documented.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.



Relevant Pages

  • Re: Strange problem when disassembling a shared lib...
    ... output from "objdump -d". ... the calls point to either the next instruction: ... will make the pages containing such relocations un-shareable. ... In order to understand recursion you must first understand recursion. ...
    (comp.os.linux.development.apps)
  • Re: understanding sbrk(0)
    ... amujoo@yahoo.com (Ash) writes: ... You need to specify your system: on my system that program gives ... system with 'exec-shield' enabled. ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.programmer)
  • Re: Memory Fragmentation Tool
    ... You didn't specify your environment, ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.programmer)
  • Re: recursive functions
    ... >> recursion, not any more than adding them up would. ... Calculating factorials isn't. ... Why would anyone want to specify the factorial recursively? ... > effort to find and validate a non-recursive solution. ...
    (comp.lang.perl.misc)
  • Re: using ptrace system call
    ... > int main ... which headers it needs, and please specify your OS. ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.programmer)