public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug record/29178] New: GDB wont print frame when reverse stepping out of recursive function
@ 2022-05-25 13:08 blarsen at redhat dot com
  2023-11-20  9:54 ` [Bug record/29178] " cvs-commit at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: blarsen at redhat dot com @ 2022-05-25 13:08 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-09 20:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 13:08 [Bug record/29178] New: GDB wont print frame when reverse stepping out of recursive function blarsen at redhat dot com
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

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