This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/16678] New: record problem with recursion
- From: "vicshen at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sun, 09 Mar 2014 11:45:13 +0000
- Subject: [Bug gdb/16678] New: record problem with recursion
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=16678
Bug ID: 16678
Summary: record problem with recursion
Product: gdb
Version: 7.7
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: vicshen at gmail dot com
I'm having problems with ProcessRecord and recursion.
It looks like the reverse-next operation behaves like
reverse-step when dealing with a recursive method.
GNU gdb (GDB) 7.7
(gdb) l
1 int factorial(int x) {
2 if (x == 1) return 1;
3 int result = x * factorial(x-1);
4 return result;
5 }
6
7 int main() {
8 factorial(5);
9 return 0;
10 }
(gdb) start
Temporary breakpoint 1 at 0x4004a9: file a.c, line 8.
Starting program: /home/jianshen/1/a
Temporary breakpoint 1, main () at a.c:8
8 factorial(5);
(gdb) record
(gdb) n
9 return 0;
(gdb) rn
factorial (x=2) at a.c:3
3 int result = x * factorial(x-1);
(gdb) bt
#0 factorial (x=2) at a.c:3
#1 0x0000000000400499 in factorial (x=3) at a.c:3
#2 0x0000000000400499 in factorial (x=4) at a.c:3
#3 0x0000000000400499 in factorial (x=5) at a.c:3
#4 0x00000000004004b3 in main () at a.c:8
rn should return to line 8 but it jumps to line 3 in another frame.
I searched and found Hui Zhu has once provided a patch for this issue.
See https://sourceware.org/ml/gdb/2009-03/msg00134.html
But in the latest version (7.7) it's still could be reproduced. It might be a
missing bug.
--
You are receiving this mail because:
You are on the CC list for the bug.