public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/19166] New: Sending SIGTERM to gdb does not remove breakpoints
@ 2015-10-23 10:35 peter at lekensteyn dot nl
  0 siblings, 0 replies; only message in thread
From: peter at lekensteyn dot nl @ 2015-10-23 10:35 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 19166
           Summary: Sending SIGTERM to gdb does not remove breakpoints
           Product: gdb
           Version: 7.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: peter at lekensteyn dot nl
  Target Milestone: ---

Overview:
Terminating gdb with SIGTERM does not remove its breakpoints, resulting in
SIGTRAP killing the debuggee when the breakpoint is hit.

Steps to Reproduce:
# 1. Create and starts test program.
cat >loop.c <<EOF
#include <unistd.h>
#include <stdio.h>
int main(void)
{
    int i = 0;
    do {
        printf("%d ", i++);
        fflush(stdout);
        write(0, "", 0);
        sleep(3);
    } while (1);
    return 0;
}
EOF
gcc -g loop.c -o loop
./loop

# 2. Attach gdb, insert a breakpoint and continue.
gdb -q -batch -ex 'break write if 0' -ex c -p `pidof loop`
# 3. stop gdb
killall gdb


Actual Results:
once the sleep is over, the program receives a SIGTRAP and terminates.

Expected Results:
GDB removes its breakpoints, the program continues to run normally.

Build date & Hardware:
GDB 7.10-4 on Arch Linux x86_64.

Additional information:
The breakpoints are correctly removed when GDB is executing. For example, if
GDB receives a SIGTERM while executing the "time.sleep" command below, it will
wait for the Python command to finish and quit gracefully:
break write
commands
py import time; print("Sleep"); time.sleep(2);
c
end

The real use case is a Python script within GDB that uses GDB's breakpoint
functionality to collect data at breakpoints. This should be non-obtrustive, so
all signals from the debuggee are passed as-is (signal all noprint pass; signal
SIGINT noprint pass). To "start" this process, I simply attach gdb. To "stop"
this process, I was aiming at terminating gdb with a signal (SIGTERM) and later
on try the "timeout" utility to stop the trace after a delay.

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-23 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23 10:35 [Bug breakpoints/19166] New: Sending SIGTERM to gdb does not remove breakpoints peter at lekensteyn dot nl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).