distinguish load and store given segmentation fault


Results 1 to 2 of 2

Thread: distinguish load and store given segmentation fault

  1. #1
    Join Date
    Aug 2005
    Posts
    2

    distinguish load and store given segmentation fault

    Hi there,

    I'm programming segmentation fault signal handling.
    I can catch the memory address and also the instruction which causes the fault. Is there an easy
    way to tell whether that instruction is a load or store instruction? Of course, a solution would be to derive that by decoding the instruction. Even for that solution, I'm not clear on how to do it quickly given the big instruction set of IA32...

    Gaven

  2. #2
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,936
    gdb will tell you... run the program under gdb, and when it segfaults, gdb will break the program at the instruction it was running when the segfault happened. You can then ask gdb to decode the assembly (or, if you built the executable with debug info and still have the original .c file around, you can get the C source).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •