Implement frame apply [all | COUNT | -COUNT | level LEVEL... ] [FLAG]... COMMAND.
Implement frame apply [all | COUNT | -COUNT | level LEVEL... ] [FLAG]... COMMAND.
Also implement the command 'faas COMMAND', a shortcut for
'frame apply all -s COMMAND'.
The syntax of 'frame apply' to specify some innermost or outermost
frames is similar to 'backtrace' command, using COUNT or -COUNT.
To apply a COMMAND to a more specific set of frames, the following
new command and syntax can be used:
frame apply level LEVEL... [FLAG]... COMMAND
where LEVEL is one or more frame levels or range of frame levels.
The new command 'frame apply' allows to apply a COMMAND to a number of frames,
or to all frames, or to a set of frames.
The optional [FLAG]... arguments allow to control what output to produce
and how to handle errors raised when applying COMMAND to a frame.
Some example usages for this new command:
frame apply all info frame
Produce info frame for all frames.
frame apply all p $sp
For each frame, print the location, followed by the frame sp.
frame apply all -q p $sp
Same as before, but -q flag (q = quiet) indicates to only print
the frames sp.
frame apply all p some_local_var_somewhere
Print some_local_var_somewhere in all frames. 'frame apply'
will abort as soon as the print command fails.
frame apply all -c p some_local_var_somewhere
Same as before, but -c flag (c = continue) means to
print the error and continue applying command in case the
print command fails.
frame apply all -s p some_local_var_somewhere
Same as before, but -s flag (s = silent) means to
be silent for frames where the print command fails.
In other words, this allows to 'search' the frame in which
some_local_var_somewhere can be printed.
frame apply all -s -q p some_local_var_somewhere
Same as before, but does not print the frame info in which
the variable is found.
frame apply level 2-4 5 8-10 -s p i = i + 1
Increments i in the identified frames.
gdb/ChangeLog
2018-07-12 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* stack.c: (trailing_outermost_frame): New function, mostly
extracted from backtrace_command_1.
(leading_innermost_frame): New function.
(backtrace_command_1): Update to call trailing_outermost_frame.
(frame_apply_command_count): New function.
(frame_apply_level_command): New function.
(frame_apply_all_command): New function.
(frame_apply_command): New function.
(faas_command): New function.
(frame_cmd_list): New variable.
(_initialize_stack): Update to setup the new commands 'frame apply'
and 'faas'.