[Bug gdb/25547] New: GDB has different behaviors when breakpoint at the first statement of a called function
yangyibiao at hust dot edu.cn
sourceware-bugzilla@sourceware.org
Thu Feb 13 14:52:00 GMT 2020
https://sourceware.org/bugzilla/show_bug.cgi?id=25547
Bug ID: 25547
Summary: GDB has different behaviors when breakpoint at the
first statement of a called function
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: yangyibiao at hust dot edu.cn
Target Milestone: ---
$ cat small.c
extern void abort(void);
static int expected;
static void handler(int *p)
{
if (*p != expected)
abort();
}
static void doit(int x, int y)
{
int r __attribute__((cleanup(handler)));
if (x < y) {
r = 0;
return;
}
}
int main()
{
doit(1, 2);
// doit(2, 1);
return 0;
}
$ gcc -g small.c; gdb -q -ex 'file ./a.out' -batch -ex 'break small.c:13' -ex
'run'
Breakpoint 1 at 0x11a1: file small.c, line 13.
[Inferior 1 (process 5714) exited normally]
$ cat small.c
extern void abort(void);
static int expected;
static void handler(int *p)
{
if (*p != expected)
abort();
}
static void doit(int x, int y)
{
int r __attribute__((cleanup(handler)));
if (x < y) {
r = 0;
return;
}
}
int main()
{
// doit(1, 2);
doit(2, 1);
return 0;
}
$ gcc -g small.c; gdb -q -ex 'file ./a.out' -batch -ex 'break small.c:13' -ex
'run'
Breakpoint 1 at 0x11a1: file small.c, line 13.
Breakpoint 1, doit (x=2, y=1) at small.c:13
13 int r __attribute__((cleanup(handler)));
###########################################################################
### We can find that, when replacing statement from "doit(1, 2)" to "doit(2,
1)" for the main function. Setting breakpoint for the first statement "int r
__attribute__((cleanup(handler)));" in the "doit" function have different
behaviors in gdb.
### doit(1, 2) lead gdb not stopped at small.c:13 (first statement in doit
function)
### doit(2, 1) lead gdb stopped at small.c:13 (first statement in doit
function)
###########################################################################
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Gdb-prs
mailing list