public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "blarsen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug record/29178] New: GDB wont print frame when reverse stepping out of recursive function
Date: Wed, 25 May 2022 13:08:03 +0000	[thread overview]
Message-ID: <bug-29178-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 29178
           Summary: GDB wont print frame when reverse stepping out of
                    recursive function
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: record
          Assignee: unassigned at sourceware dot org
          Reporter: blarsen at redhat dot com
  Target Milestone: ---

GDB won't print the frame information when reverse stepping out of a reverse
function, despite printing the information when it enters the functions, or
when it leaves non-recursive functions.

Reproducer:

int factorial(int n){
    int result;
    if(n <= 1) result = 1;
    result = n * factorial(n - 1);
    return result;
}

int main(){
    factorial(5);
    return 0;
}

And using the following commands:

(gdb) start
25          factorial(5);
(gdb) record
(gdb) n
27          return 0;                                                           
(gdb) rs                                                                        
factorial (x=5) at 16678.c:10                                                   
10      }                                                                       
(gdb)                                                                           
9           return result;                                                      
(gdb)                                                                           
8           else result = x * factorial(x-1);                                   
(gdb)                                                                           
factorial (x=4) at 16678.c:10                                                   
10      }                                                                       
(gdb)                                                                           
9           return result;                                                      
(gdb)                                                                           
8           else result = x * factorial(x-1);                                   
(gdb)                                                                           
factorial (x=3) at 16678.c:10                                                   
10      }                                                                       
(gdb)                                                                           
9           return result;                                                      
(gdb)                                                                           
8           else result = x * factorial(x-1);                                   
(gdb)                                                                           
factorial (x=2) at 16678.c:10
10      }
(gdb)
9           return result;
(gdb)
8           else result = x * factorial(x-1);
(gdb)
factorial (x=1) at 16678.c:10
10      }
(gdb)
9           return result;
(gdb)
7           if(x <= 1) result = 1;
(gdb)
8           else result = x * factorial(x-1);
7           if(x <= 1) result = 1;
(gdb)
8           else result = x * factorial(x-1);
(gdb)
7           if(x <= 1) result = 1;
(gdb)
8           else result = x * factorial(x-1);
(gdb)
7           if(x <= 1) result = 1;
(gdb) rn
8           else result = x * factorial(x-1);
(gdb)
7           if(x <= 1) result = 1;

As can be seen, we don't get information about the depth when reverse stepping
out.

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

             reply	other threads:[~2022-05-25 13:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 13:08 blarsen at redhat dot com [this message]
2023-11-20  9:54 ` [Bug record/29178] " cvs-commit at gcc dot gnu.org
2023-11-20 10:01 ` blarsen at redhat dot com
2024-01-21 16:25 ` cvs-commit at gcc dot gnu.org
2024-05-09 20:07 ` blarsen at redhat dot com

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-29178-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).