This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Use of create_new_frame from 'frame'.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]