* Patch to add relative stack level support to stack-select-frame MIcommand
@ 2002-07-24 23:41 Mo DeJong
2002-07-25 16:30 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Mo DeJong @ 2002-07-24 23:41 UTC (permalink / raw)
To: gdb-patches
Greetings
I am been working with the MI recently and ran into a
real problem with the stack-select-frame method.
While it can be used to change the stack to a new level,
there is no way to just move up or down a level like
the cli up and down commands. The appended patch implements
the missing functionality. For example, one could move
down a stack level like so:
-stack-select-frame -1
This patch is for the CVS HEAD, it includes patches for
the docs and the testsuite.
cheers
Mo DeJong
% cat rel_stack.patch
2002-07-24 Mo DeJong <supermo@bayarea.net>
* stack.c (up_silently_command_wrapper,
down_silently_command_wrapper): Add wrappers for up
and down commands for use in mi/mi-cmd-stack.c.
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.40
diff -u -r1.40 stack.c
--- stack.c 11 Jul 2002 19:29:08 -0000 1.40
+++ stack.c 25 Jul 2002 04:55:43 -0000
@@ -1676,6 +1676,11 @@
select_frame (fi);
}
+void
+up_silently_command_wrapper (char *count_exp) {
+ up_silently_command(count_exp, 1 /* unused */);
+}
+
static void
up_silently_command (char *count_exp, int from_tty)
{
@@ -1719,6 +1724,11 @@
}
select_frame (frame);
+}
+
+void
+down_silently_command_wrapper (char *count_exp) {
+ down_silently_command(count_exp, 1 /* unused */);
}
/* ARGSUSED */
% cat mi/mi_rel_stack.patch
2002-07-24 Mo DeJong <supermo@bayarea.net>
* gdbmi.texinfo (stack-select-frame): Mention
support for relative frame levels like +1 and -2.
* mi-cmd-stack.c (mi_cmd_stack_select_frame):
Add support for relative stack frame levels
to the stack-select-frame mi command.
Index: gdbmi.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/mi/gdbmi.texinfo,v
retrieving revision 1.27
diff -u -r1.27 gdbmi.texinfo
--- gdbmi.texinfo 17 Jun 2002 17:30:57 -0000 1.27
+++ gdbmi.texinfo 25 Jul 2002 05:13:12 -0000
@@ -2826,7 +2826,8 @@
@end example
Change the current frame. Select a different frame @var{framenum} on
-the stack.
+the stack. If prefixed by a '+' or '-' character, the @var{framenum}
+is interpreted as an offset from the current frame.
@subsubheading @value{GDBN} Command
@@ -2838,6 +2839,8 @@
@smallexample
(@value{GDBP})
-stack-select-frame 2
+^done
+-stack-select-frame -1
^done
(@value{GDBP})
@end smallexample
Index: mi-cmd-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
retrieving revision 1.11
diff -u -r1.11 mi-cmd-stack.c
--- mi-cmd-stack.c 5 Apr 2002 22:04:43 -0000 1.11
+++ mi-cmd-stack.c 25 Jul 2002 05:13:13 -0000
@@ -32,6 +32,10 @@
we pull the plug on the sanitization. */
extern void select_frame_command_wrapper (char *, int);
+extern void up_silently_command_wrapper (char *count_exp);
+
+extern void down_silently_command_wrapper (char *count_exp);
+
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
/* Print a list of the stack frames. Args can be none, in which case
@@ -304,6 +308,13 @@
if (argc == 0)
select_frame_command_wrapper (0, 1 /* not used */ );
else
- select_frame_command_wrapper (argv[0], 1 /* not used */ );
+ {
+ if (argv[0][0] == '+')
+ up_silently_command_wrapper(&argv[0][1]);
+ else if (argv[0][0] == '-')
+ down_silently_command_wrapper(&argv[0][1]);
+ else
+ select_frame_command_wrapper (argv[0], 1 /* not used */ );
+ }
return MI_CMD_DONE;
}
% cat testsuite/gdb.mi/testsuite_rel_stack.patch
2002-07-24 Mo DeJong <supermo@bayarea.net>
* mi-stack.exp: Add tests for relative stack
frame with stack-select-frame command.
Index: mi-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v
retrieving revision 1.8
diff -u -r1.8 mi-stack.exp
--- mi-stack.exp 19 Aug 2001 01:23:43 -0000 1.8
+++ mi-stack.exp 25 Jul 2002 05:14:39 -0000
@@ -192,6 +192,14 @@
"232\\^done" \
"stack select frame 1"
+ mi_gdb_test "232-stack-select-frame +1" \
+ "232\\^done" \
+ "stack select frame +1"
+
+ mi_gdb_test "232-stack-select-frame -1" \
+ "232\\^done" \
+ "stack select frame -1"
+
mi_gdb_test "232-stack-list-locals 1" \
"232\\^done,locals=\\\[\\\]" \
"stack locals listing for new frame"
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch to add relative stack level support to stack-select-frame MIcommand
2002-07-24 23:41 Patch to add relative stack level support to stack-select-frame MIcommand Mo DeJong
@ 2002-07-25 16:30 ` Andrew Cagney
2002-07-25 20:47 ` Mo DeJong
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-07-25 16:30 UTC (permalink / raw)
To: Mo DeJong; +Cc: gdb-patches
> Greetings
>
> I am been working with the MI recently and ran into a
> real problem with the stack-select-frame method.
> While it can be used to change the stack to a new level,
> there is no way to just move up or down a level like
> the cli up and down commands. The appended patch implements
> the missing functionality. For example, one could move
> down a stack level like so:
>
> -stack-select-frame -1
>
> This patch is for the CVS HEAD, it includes patches for
> the docs and the testsuite.
Can you post a patch just describing proposed new syntax gdb@ if no one
jumps we'll go through with this.
> Index: stack.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/stack.c,v
> retrieving revision 1.40
> diff -u -r1.40 stack.c
> --- stack.c 11 Jul 2002 19:29:08 -0000 1.40
> +++ stack.c 25 Jul 2002 04:55:43 -0000
> @@ -1676,6 +1676,11 @@
> select_frame (fi);
> }
>
> +void
> +up_silently_command_wrapper (char *count_exp) {
> + up_silently_command(count_exp, 1 /* unused */);
> +}
> +
Coding, brace on new line. Space before lparen.
> static void
> up_silently_command (char *count_exp, int from_tty)
> {
> @@ -1719,6 +1724,11 @@
> }
>
> select_frame (frame);
> +}
> +
> +void
> +down_silently_command_wrapper (char *count_exp) {
> + down_silently_command(count_exp, 1 /* unused */);
> }
Ditto.
> Index: gdbmi.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/gdbmi.texinfo,v
> retrieving revision 1.27
> diff -u -r1.27 gdbmi.texinfo
> --- gdbmi.texinfo 17 Jun 2002 17:30:57 -0000 1.27
> +++ gdbmi.texinfo 25 Jul 2002 05:13:12 -0000
> @@ -2826,7 +2826,8 @@
> @end example
>
> Change the current frame. Select a different frame @var{framenum} on
> -the stack.
> +the stack. If prefixed by a '+' or '-' character, the @var{framenum}
> +is interpreted as an offset from the current frame.
Can this be expanded. Clarify the direction that +/- go in. -1 towards
the inner most frame, +1 towards the outer most frame.
What does:
-stack-select-frame 0
-stack-select-frame -1
> @subsubheading @value{GDBN} Command
>
> @@ -2838,6 +2839,8 @@
> @smallexample
> (@value{GDBP})
> -stack-select-frame 2
> +^done
> +-stack-select-frame -1
> ^done
Suggest printing the current frame here.
> (@value{GDBP})
> @end smallexample
> Index: mi-cmd-stack.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
> retrieving revision 1.11
> diff -u -r1.11 mi-cmd-stack.c
> --- mi-cmd-stack.c 5 Apr 2002 22:04:43 -0000 1.11
> +++ mi-cmd-stack.c 25 Jul 2002 05:13:13 -0000
> @@ -32,6 +32,10 @@
> we pull the plug on the sanitization. */
> extern void select_frame_command_wrapper (char *, int);
>
> +extern void up_silently_command_wrapper (char *count_exp);
> +
> +extern void down_silently_command_wrapper (char *count_exp);
> +
These extern's need to be put in a header file (yes
select_frame_command_wrapper()) was already wrong :-().
> static void list_args_or_locals (int locals, int values, struct frame_info *fi);
>
> /* Print a list of the stack frames. Args can be none, in which case
> @@ -304,6 +308,13 @@
> if (argc == 0)
> select_frame_command_wrapper (0, 1 /* not used */ );
> else
> - select_frame_command_wrapper (argv[0], 1 /* not used */ );
> + {
> + if (argv[0][0] == '+')
> + up_silently_command_wrapper(&argv[0][1]);
> + else if (argv[0][0] == '-')
> + down_silently_command_wrapper(&argv[0][1]);
> + else
> + select_frame_command_wrapper (argv[0], 1 /* not used */ );
Again coding.
> + }
> return MI_CMD_DONE;
> }
>
> % cat testsuite/gdb.mi/testsuite_rel_stack.patch
> 2002-07-24 Mo DeJong <supermo@bayarea.net>
>
> * mi-stack.exp: Add tests for relative stack
> frame with stack-select-frame command.
>
> Index: mi-stack.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v
> retrieving revision 1.8
> diff -u -r1.8 mi-stack.exp
> --- mi-stack.exp 19 Aug 2001 01:23:43 -0000 1.8
> +++ mi-stack.exp 25 Jul 2002 05:14:39 -0000
> @@ -192,6 +192,14 @@
> "232\\^done" \
> "stack select frame 1"
>
> + mi_gdb_test "232-stack-select-frame +1" \
> + "232\\^done" \
> + "stack select frame +1"
> +
Can these check that the frame went in the right direction.
Hmm, nope, I'll post something to gdb@
> + mi_gdb_test "232-stack-select-frame -1" \
> + "232\\^done" \
> + "stack select frame -1"
> +
> mi_gdb_test "232-stack-list-locals 1" \
> "232\\^done,locals=\\\[\\\]" \
> "stack locals listing for new frame"
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch to add relative stack level support to stack-select-frame MIcommand
2002-07-25 16:30 ` Andrew Cagney
@ 2002-07-25 20:47 ` Mo DeJong
2002-07-29 13:51 ` Mo DeJong
0 siblings, 1 reply; 5+ messages in thread
From: Mo DeJong @ 2002-07-25 20:47 UTC (permalink / raw)
To: gdb-patches
On Thu, 25 Jul 2002 19:05:46 -0400
Andrew Cagney <ac131313@ges.redhat.com> wrote:
> > This patch is for the CVS HEAD, it includes patches for
> > the docs and the testsuite.
>
> Can you post a patch just describing proposed new syntax gdb@ if no one
> jumps we'll go through with this.
Will do.
> > +void
> > +up_silently_command_wrapper (char *count_exp) {
> > + up_silently_command(count_exp, 1 /* unused */);
> > +}
> > +
>
> Coding, brace on new line. Space before lparen.
Doh. I have appended a new patch to fix that along with
the other things you mentioned.
> > Change the current frame. Select a different frame @var{framenum} on
> > -the stack.
> > +the stack. If prefixed by a '+' or '-' character, the @var{framenum}
> > +is interpreted as an offset from the current frame.
>
> Can this be expanded. Clarify the direction that +/- go in. -1 towards
> the inner most frame, +1 towards the outer most frame.
I have attempted to address this in the appended patch.
> What does:
>
> -stack-select-frame 0
> -stack-select-frame -1
It would generate an error, same as the down command.
> > -stack-select-frame 2
> > +^done
> > +-stack-select-frame -1
> > ^done
>
> Suggest printing the current frame here.
That might be a good idea, but it would break compatibility with
earlier versions.
...
> > + mi_gdb_test "232-stack-select-frame +1" \
> > + "232\\^done" \
> > + "stack select frame +1"
> > +
>
> Can these check that the frame went in the right direction.
>
> Hmm, nope, I'll post something to gdb@
No, I posted another patch that would implement a stack-info-frame
command, but it is a separate issue.
Here is the updated patch:
2002-07-25 Mo DeJong <supermo@bayarea.net>
* stack.c (up_silently_command_wrapper,
down_silently_command_wrapper): Add wrappers for up
and down commands for use in mi/mi-cmd-stack.c.
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.40
diff -u -r1.40 stack.c
--- stack.c 11 Jul 2002 19:29:08 -0000 1.40
+++ stack.c 26 Jul 2002 02:43:32 -0000
@@ -1676,6 +1676,12 @@
select_frame (fi);
}
+void
+up_silently_command_wrapper (char *count_exp)
+{
+ up_silently_command (count_exp, 1 /* unused */);
+}
+
static void
up_silently_command (char *count_exp, int from_tty)
{
@@ -1719,6 +1725,12 @@
}
select_frame (frame);
+}
+
+void
+down_silently_command_wrapper (char *count_exp)
+{
+ down_silently_command (count_exp, 1 /* unused */);
}
/* ARGSUSED */
2002-07-25 Mo DeJong <supermo@bayarea.net>
* gdbmi.texinfo (stack-select-frame): Mention
support for relative frame levels like +1 and -2.
* mi-cmd-stack.c (mi_cmd_stack_select_frame):
Add support for relative stack frame levels
to the stack-select-frame mi command.
Index: gdbmi.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/mi/gdbmi.texinfo,v
retrieving revision 1.27
diff -u -r1.27 gdbmi.texinfo
--- gdbmi.texinfo 17 Jun 2002 17:30:57 -0000 1.27
+++ gdbmi.texinfo 26 Jul 2002 02:57:12 -0000
@@ -2826,7 +2826,10 @@
@end example
Change the current frame. Select a different frame @var{framenum} on
-the stack.
+the stack. If prefixed by a '+' or '-' character, the @var{framenum}
+is interpreted as an offset from the current frame. A '+' prefix moves
+the current frame towards the outer most frame while a '-' prefix moves
+the current frame towards the inner most frame.
@subsubheading @value{GDBN} Command
@@ -2838,6 +2841,10 @@
@smallexample
(@value{GDBP})
-stack-select-frame 2
+^done
+-stack-select-frame -2
+^done
+-stack-select-frame +1
^done
(@value{GDBP})
@end smallexample
Index: mi-cmd-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
retrieving revision 1.11
diff -u -r1.11 mi-cmd-stack.c
--- mi-cmd-stack.c 5 Apr 2002 22:04:43 -0000 1.11
+++ mi-cmd-stack.c 26 Jul 2002 02:57:12 -0000
@@ -32,6 +32,10 @@
we pull the plug on the sanitization. */
extern void select_frame_command_wrapper (char *, int);
+extern void up_silently_command_wrapper (char *count_exp);
+
+extern void down_silently_command_wrapper (char *count_exp);
+
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
/* Print a list of the stack frames. Args can be none, in which case
@@ -304,6 +308,13 @@
if (argc == 0)
select_frame_command_wrapper (0, 1 /* not used */ );
else
- select_frame_command_wrapper (argv[0], 1 /* not used */ );
+ {
+ if (argv[0][0] == '+')
+ up_silently_command_wrapper (&argv[0][1]);
+ else if (argv[0][0] == '-')
+ down_silently_command_wrapper (&argv[0][1]);
+ else
+ select_frame_command_wrapper (argv[0], 1 /* not used */ );
+ }
return MI_CMD_DONE;
}
2002-07-25 Mo DeJong <supermo@bayarea.net>
* mi-stack.exp: Add tests for relative stack
frame with stack-select-frame command.
Index: mi-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v
retrieving revision 1.8
diff -u -r1.8 mi-stack.exp
--- mi-stack.exp 19 Aug 2001 01:23:43 -0000 1.8
+++ mi-stack.exp 26 Jul 2002 02:45:43 -0000
@@ -192,6 +192,14 @@
"232\\^done" \
"stack select frame 1"
+ mi_gdb_test "232-stack-select-frame +1" \
+ "232\\^done" \
+ "stack select frame +1"
+
+ mi_gdb_test "232-stack-select-frame -1" \
+ "232\\^done" \
+ "stack select frame -1"
+
mi_gdb_test "232-stack-list-locals 1" \
"232\\^done,locals=\\\[\\\]" \
"stack locals listing for new frame"
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch to add relative stack level support to stack-select-frame MIcommand
2002-07-25 20:47 ` Mo DeJong
@ 2002-07-29 13:51 ` Mo DeJong
2002-07-29 15:20 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Mo DeJong @ 2002-07-29 13:51 UTC (permalink / raw)
To: gdb-patches
On Thu, 25 Jul 2002 20:11:25 -0700
Mo DeJong <supermo@bayarea.net> wrote:
> On Thu, 25 Jul 2002 19:05:46 -0400
> Andrew Cagney <ac131313@ges.redhat.com> wrote:
>
> > > This patch is for the CVS HEAD, it includes patches for
> > > the docs and the testsuite.
> >
> > Can you post a patch just describing proposed new syntax gdb@ if no one
> > jumps we'll go through with this.
I posted a note to the gdb list 4 days ago and there were no objections.
Does this patch look ok to go into the HEAD. If it could be added to the
5.2.1 branch, that would be great too.
thanks
Mo DeJong
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Patch to add relative stack level support to stack-select-frame MIcommand
2002-07-29 13:51 ` Mo DeJong
@ 2002-07-29 15:20 ` Andrew Cagney
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-07-29 15:20 UTC (permalink / raw)
To: Mo DeJong; +Cc: gdb-patches
> On Thu, 25 Jul 2002 20:11:25 -0700
> Mo DeJong <supermo@bayarea.net> wrote:
>
>
>> On Thu, 25 Jul 2002 19:05:46 -0400
>> Andrew Cagney <ac131313@ges.redhat.com> wrote:
>>
>
>> > > This patch is for the CVS HEAD, it includes patches for
>> > > the docs and the testsuite.
>
>> >
>> > Can you post a patch just describing proposed new syntax gdb@ if no one
>> > jumps we'll go through with this.
>
>
> I posted a note to the gdb list 4 days ago and there were no objections.
> Does this patch look ok to go into the HEAD. If it could be added to the
> 5.2.1 branch, that would be great too.
``Everything on the internet takes a week.'' (me?)
Branches are normally for bug fixes. This new functionality should just
be for the trunk.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-07-29 22:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-24 23:41 Patch to add relative stack level support to stack-select-frame MIcommand Mo DeJong
2002-07-25 16:30 ` Andrew Cagney
2002-07-25 20:47 ` Mo DeJong
2002-07-29 13:51 ` Mo DeJong
2002-07-29 15:20 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox