public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vicshen at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/16678] New: record problem with recursion
Date: Sun, 09 Mar 2014 11:45:00 -0000	[thread overview]
Message-ID: <bug-16678-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-03-09 11:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-09 11:45 vicshen at gmail dot com [this message]
2022-10-21 10:49 ` [Bug gdb/16678] " cvs-commit at gcc dot gnu.org
2022-10-21 10:49 ` cvs-commit at gcc dot gnu.org
2022-10-21 10:52 ` blarsen at redhat dot com
2023-01-25 12:27 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-16678-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).