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 breakpoints/19166] New: Sending SIGTERM to gdb does not remove breakpoints


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.


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