* [RFC] Use of create_new_frame from 'frame'.
@ 2015-07-08 17:09 Andrew Burgess
2015-07-08 18:02 ` Pedro Alves
2015-07-08 19:42 ` Eli Zaretskii
0 siblings, 2 replies; 6+ messages in thread
From: Andrew Burgess @ 2015-07-08 17:09 UTC (permalink / raw)
To: gdb-patches
The 'frame' command can cause 'create_new_frame' in some conditions:
- When two arguments are passed, or
- When one argument is passed that is not:
- A valid index into the backtrace, or
- A valid stack frame base address.
Personally, I dislike this behaviour because:
1. It's easy to make a mistake using the frame command and create a
new frame. It's not obvious (I think) how to recover from this
situation. [ The answer is just to use 'frame' again with a
valid frame specifier argument. ]
2. As a backtrace can be possibly any depth then depending on where
we stop alters which frames we can create. This seems a little
arbitrary.
We could improve #1 by not allowing small indexes that are close to
the number of frames in the backtrace, however, this feels like a bit
of a hack, and would be a little annoying on small targets where low
value addresses are actually valid.
I wonder then if there's a better way to offer this feature. The two
possible choices (other suggestions welcome) are:
1. Create a new command 'create-frame' that takes one or two
arguments, and always creates and selects a new frame new frame.
The frame command no longer creates new frames.
2. Make 'frame' take an (optional) flag (like 'x', or
'disassemble'), so a user can now say:
frame /c STACK-ADDR PC-ADDR
in order to create (and select) a new frame. Without the /c flag
no new frames are created. With the flag only new frames are
created, old frames are not selected.
What do people think? Any alternative suggestions?
Thanks,
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] Use of create_new_frame from 'frame'.
2015-07-08 17:09 [RFC] Use of create_new_frame from 'frame' Andrew Burgess
@ 2015-07-08 18:02 ` Pedro Alves
2015-07-08 19:42 ` Eli Zaretskii
1 sibling, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2015-07-08 18:02 UTC (permalink / raw)
To: Andrew Burgess, gdb-patches
On 07/08/2015 06:09 PM, Andrew Burgess wrote:
> The 'frame' command can cause 'create_new_frame' in some conditions:
>
> - When two arguments are passed, or
> - When one argument is passed that is not:
> - A valid index into the backtrace, or
> - A valid stack frame base address.
>
> Personally, I dislike this behaviour because:
>
> 1. It's easy to make a mistake using the frame command and create a
> new frame. It's not obvious (I think) how to recover from this
> situation. [ The answer is just to use 'frame' again with a
> valid frame specifier argument. ]
>
> 2. As a backtrace can be possibly any depth then depending on where
> we stop alters which frames we can create. This seems a little
> arbitrary.
>
Totally agreed. See here for my previous suggestions:
https://sourceware.org/ml/gdb/2014-11/msg00028.html
Related bugs:
https://sourceware.org/bugzilla/show_bug.cgi?id=18074
https://sourceware.org/bugzilla/show_bug.cgi?id=8864
> We could improve #1 by not allowing small indexes that are close to
> the number of frames in the backtrace, however, this feels like a bit
> of a hack, and would be a little annoying on small targets where low
> value addresses are actually valid.
Yeah, yuck. :-)
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] Use of create_new_frame from 'frame'.
2015-07-08 17:09 [RFC] Use of create_new_frame from 'frame' Andrew Burgess
2015-07-08 18:02 ` Pedro Alves
@ 2015-07-08 19:42 ` Eli Zaretskii
2015-07-08 19:46 ` Pedro Alves
2015-07-08 20:16 ` Andrew Burgess
1 sibling, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2015-07-08 19:42 UTC (permalink / raw)
To: Andrew Burgess; +Cc: gdb-patches
> Date: Wed, 8 Jul 2015 18:09:44 +0100
> From: Andrew Burgess <andrew.burgess@embecosm.com>
>
> I wonder then if there's a better way to offer this feature. The two
> possible choices (other suggestions welcome) are:
>
> 1. Create a new command 'create-frame' that takes one or two
> arguments, and always creates and selects a new frame new frame.
> The frame command no longer creates new frames.
>
> 2. Make 'frame' take an (optional) flag (like 'x', or
> 'disassemble'), so a user can now say:
> frame /c STACK-ADDR PC-ADDR
> in order to create (and select) a new frame. Without the /c flag
> no new frames are created. With the flag only new frames are
> created, old frames are not selected.
You could also ask the user for confirmation, when the command is
going to create a new frame.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] Use of create_new_frame from 'frame'.
2015-07-08 19:42 ` Eli Zaretskii
@ 2015-07-08 19:46 ` Pedro Alves
2015-07-08 20:06 ` Eli Zaretskii
2015-07-08 20:16 ` Andrew Burgess
1 sibling, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2015-07-08 19:46 UTC (permalink / raw)
To: Eli Zaretskii, Andrew Burgess; +Cc: gdb-patches
On 07/08/2015 08:42 PM, Eli Zaretskii wrote:
>> Date: Wed, 8 Jul 2015 18:09:44 +0100
>> From: Andrew Burgess <andrew.burgess@embecosm.com>
>>
>> I wonder then if there's a better way to offer this feature. The two
>> possible choices (other suggestions welcome) are:
>>
>> 1. Create a new command 'create-frame' that takes one or two
>> arguments, and always creates and selects a new frame new frame.
>> The frame command no longer creates new frames.
>>
>> 2. Make 'frame' take an (optional) flag (like 'x', or
>> 'disassemble'), so a user can now say:
>> frame /c STACK-ADDR PC-ADDR
>> in order to create (and select) a new frame. Without the /c flag
>> no new frames are created. With the flag only new frames are
>> created, old frames are not selected.
>
> You could also ask the user for confirmation, when the command is
> going to create a new frame.
I'd rather the explicit approach, because querying works when
in interactive mode, but not with scripts.
(and because I see no benefit to the current overloading
of number/address, only downsides.)
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] Use of create_new_frame from 'frame'.
2015-07-08 19:46 ` Pedro Alves
@ 2015-07-08 20:06 ` Eli Zaretskii
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2015-07-08 20:06 UTC (permalink / raw)
To: Pedro Alves; +Cc: andrew.burgess, gdb-patches
> Date: Wed, 08 Jul 2015 20:46:17 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org
>
> > You could also ask the user for confirmation, when the command is
> > going to create a new frame.
>
> I'd rather the explicit approach, because querying works when
> in interactive mode, but not with scripts.
We've got the same situation with umpteen other commands, and we also
have a solution for scripts: we implicitly assume a NO answer.
But I'm not going to insist. I just wanted to remind us that there's
one more alternative.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] Use of create_new_frame from 'frame'.
2015-07-08 19:42 ` Eli Zaretskii
2015-07-08 19:46 ` Pedro Alves
@ 2015-07-08 20:16 ` Andrew Burgess
1 sibling, 0 replies; 6+ messages in thread
From: Andrew Burgess @ 2015-07-08 20:16 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
* Eli Zaretskii <eliz@gnu.org> [2015-07-08 22:42:08 +0300]:
> > Date: Wed, 8 Jul 2015 18:09:44 +0100
> > From: Andrew Burgess <andrew.burgess@embecosm.com>
> >
> > I wonder then if there's a better way to offer this feature. The two
> > possible choices (other suggestions welcome) are:
> >
> > 1. Create a new command 'create-frame' that takes one or two
> > arguments, and always creates and selects a new frame new frame.
> > The frame command no longer creates new frames.
> >
> > 2. Make 'frame' take an (optional) flag (like 'x', or
> > 'disassemble'), so a user can now say:
> > frame /c STACK-ADDR PC-ADDR
> > in order to create (and select) a new frame. Without the /c flag
> > no new frames are created. With the flag only new frames are
> > created, old frames are not selected.
>
> You could also ask the user for confirmation, when the command is
> going to create a new frame.
That's certainly a possible option. I didn't list it as it does not
in itself solve the problem of different length backtraces preventing
the creation of frames; a backtrace of length 100 means the user can't
create a frame at address 100.
Thanks,
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-08 20:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08 17:09 [RFC] Use of create_new_frame from 'frame' Andrew Burgess
2015-07-08 18:02 ` Pedro Alves
2015-07-08 19:42 ` Eli Zaretskii
2015-07-08 19:46 ` Pedro Alves
2015-07-08 20:06 ` Eli Zaretskii
2015-07-08 20:16 ` Andrew Burgess
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).