This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] block_innermost_frame tweak


I would like to make the following change:

2002-06-20  Joel Brobecker  <brobecker@gnat.com>

        * blockframe.c (block_innermost_frame): Fix a boundary condition
        bug that was causing GDB to sometimes fail to find the frame
        executing inside the given block.

I verified this change on Linux, and this introduced no regression.

We found out about this problem when we tried in a very particular Ada
program to print the value of a variable. Here are the details:

The Ada program (sorry, I tried the equivalent C program, but the
problem did not reproduce there):
<<
           procedure Try is
              procedure Inside is
              begin
                null;
              end Inside;
           begin
              declare
                Local : Integer := 18;
              begin
                Inside;
              end;
           end Try;
>>

After hitting a  breakpoint inside procedure "Inside", then going one
frame up, GDB should be able to print the value of "Local", but instead
says:

           No frame is currently executing in specified block

This is because selected_frame->pc points to the instruction following
the call to inside (ie this is more a return address than the pc), which
is right at the boundary of the block for which we are trying to find
the innermost frame... Hence the change I am suggesting.

OK to commit?

By the way, I think we have several places where we check whether a
frame is an innermost frame or not, so I think it would be useful to
create a public function in frame.h that would look like this:

     extern int frame_innermost_p (struct frame_info *);

(implemented in blockframe.c). I can submit this addition as a followup
patch if you think this is a good idea.

Thanks,
-- 
Joel

Attachment: blockframe.c.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]