backtrace changes current source location

Felix Lee
Fri Oct 29 22:07:00 GMT 2004

Andrew Cagney <>:
> Can you find out why selected sal is being corrupted, code shouldn't be 
> modifying it.

this is happening in stack.c:print_frame_info().  any time
information about a frame is printed, sal is set to that frame's
location.  the motivation for that change was an MI issue where
sal didn't get set when it should be.

it seems reasonable to me to always set sal when a frame gets
printed, but this is inconvenient in the case of backtraces.
backtraces seem like an exception, rather than a flaw in the
general strategy, which is why I chose to save/restore sal in

my feeling is that sal is a user convenience for reducing typing,
and programs talking to gdb should not depend on it being
predictable, since it's easy for a program to specify precisely
what source location they're interested in.  but I don't feel
strongly about that.  I'll submit a new patch with the changes
you suggest.

More information about the Gdb-patches mailing list