This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug remote/19295] New: gdbserver: Detaching after calling function by hand results in spurious SIGSEGV


https://sourceware.org/bugzilla/show_bug.cgi?id=19295

            Bug ID: 19295
           Summary: gdbserver: Detaching after calling function by hand
                    results in spurious SIGSEGV
           Product: gdb
           Version: 7.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: remote
          Assignee: unassigned at sourceware dot org
          Reporter: nshulga at nvidia dot com
  Target Milestone: ---

Following command reproduces the crash: 
$ echo 'int main(void) {while(1); return 0;}' | gcc -o whileone -x c -;
./whileone & gdbserver :2345 --attach `pidof whileone` & gdb ./whileone -ex
'target remote :2345' -ex 'call printf("Hello World!\n")' -ex 'detach' -batch
[1] 22492
[2] 22493
Attached; pid = 22492
Listening on port 2345
Remote debugging from host 127.0.0.1
...
0x00000000004004fa in main ()
Hello World!
$1 = 13
Detaching from process 22492
[2]+  Done                    gdbserver :2345 --attach `pidof whileone`
[1]+  Segmentation fault      (core dumped) ./whileone


As far as I understand, it happens because dynamic function call trampoline is
constructed on a non-executable stack, i.e. breakpoint set on stack after
return from the function call is reported by SIGSEGV rather than SIGTRAP, which
results in get_detach_signal() routine return SIGSEGV for the thread that was
used to invoke the function

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]