This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] -stack-select-frame
> > -stack-select-frame without an argument currently works like the CLI
> > command "frame" without the output. All "frame" does is output the
> > current frame, so without output its a bit of a no-op.
>
> OK, so obviously that's a loss. Either we should:
> - reject it without an argument
> - make it print without an argument
> - make it print always
>
> You did the last of those. I'm trying to figure out if other users of
> -stack-select-frame want that behavior.
>
> > > Could you explain why you think we need output here?
> >
> > If you have a backtrace then, no, you don't need the output and the
> > frontend can ignore it. However, I presume "-stack-select-frame" runs
> > more quickly than "-stack-list-frames" so, if you don't need a backtrace,
> > its probably best not to require one.
>
> We've already got -stack-info-frame. If you want to avoid
> -stack-list-frames, is it unreasonable to do the two round trips for
> -stack-select-frame / -stack-info-frame? From Jason's measurements, it
> sounds like that isn't a problem.
-stack-info-frame hasn't been implemented yet (I've think we've been here
before) but it would probably be quite easy to implement and I guess it
could work like I've made -stack-select-frame without an argument work.
However, the documentation suggests that it should work like "info frame",
so perhaps its expected to have more information.
Its also just occurred to me that "-stack-list-frames 0 0" is similar too.
> Not that it would be a terrible change to print out the frame. It's
> just a question of whether there's benefit. It'll make
> -stack-select-frame (again, only marginally) slower.
How about installing your second choice, just printing the frame when there is
no argument? I presume that when Apple use -stack-select-frame, it is always
with an argument (doco will change to match):
More generally I think it would be a good idea to mention in the manual
that MI is still undergoing change to reduce the obligation to maintain
legacy code.
*** /home/nick/src/gdb/mi/mi-cmd-stack.c.~1.25.~ 2005-02-13 00:36:20.000000000 +1300
--- /home/nick/src/gdb/mi/mi-cmd-stack.c 2005-06-17 14:57:19.000000000 +1200
***************
*** 47,55 ****
struct cleanup *cleanup_stack;
struct frame_info *fi;
- if (!target_has_stack)
- error (_("mi_cmd_stack_list_frames: No stack."));
-
if (argc > 2 || argc == 1)
error (_("mi_cmd_stack_list_frames: Usage: [FRAME_LOW FRAME_HIGH]"));
--- 47,52 ----
***************
*** 104,112 ****
int i;
struct frame_info *fi;
- if (!target_has_stack)
- error (_("mi_cmd_stack_info_depth: No stack."));
-
if (argc > 1)
error (_("mi_cmd_stack_info_depth: Usage: [MAX_DEPTH]"));
--- 101,106 ----
***************
*** 329,343 ****
enum mi_cmd_result
mi_cmd_stack_select_frame (char *command, char **argv, int argc)
{
- if (!target_has_stack)
- error (_("mi_cmd_stack_select_frame: No stack."));
-
if (argc > 1)
error (_("mi_cmd_stack_select_frame: Usage: [FRAME_SPEC]"));
/* with no args, don't change frame */
if (argc == 0)
! select_frame_command (0, 1 /* not used */ );
else
select_frame_command (argv[0], 1 /* not used */ );
return MI_CMD_DONE;
--- 323,337 ----
enum mi_cmd_result
mi_cmd_stack_select_frame (char *command, char **argv, int argc)
{
if (argc > 1)
error (_("mi_cmd_stack_select_frame: Usage: [FRAME_SPEC]"));
/* with no args, don't change frame */
if (argc == 0)
! {
! select_frame_command (0, 1 /* not used */ );
! print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS);
! }
else
select_frame_command (argv[0], 1 /* not used */ );
return MI_CMD_DONE;