Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* substitute gdb convenience variable into gdb command
@ 2008-02-12 15:54 Yakov Lerner
  2008-02-12 16:03 ` Daniel Jacobowitz
  2008-02-12 19:41 ` Michael Snyder
  0 siblings, 2 replies; 6+ messages in thread
From: Yakov Lerner @ 2008-02-12 15:54 UTC (permalink / raw)
  To: gdb

How do I substitute value of gdb convenience variable into gdb command ?

For example:
    set $thread_num=5
    thread apply $thread_num where
    Error parsing $thread_num where
    eval thread apply $thread_num where
    Undefined command: "eval".  Try "help".

Thanks
Y.L.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: substitute gdb convenience variable into gdb command
  2008-02-12 15:54 substitute gdb convenience variable into gdb command Yakov Lerner
@ 2008-02-12 16:03 ` Daniel Jacobowitz
  2008-02-12 22:09   ` Michael Snyder
  2008-02-12 19:41 ` Michael Snyder
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2008-02-12 16:03 UTC (permalink / raw)
  To: Yakov Lerner; +Cc: gdb

On Tue, Feb 12, 2008 at 05:54:33PM +0200, Yakov Lerner wrote:
> How do I substitute value of gdb convenience variable into gdb command ?

Sorry, there's no way to do this.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: substitute gdb convenience variable into gdb command
  2008-02-12 15:54 substitute gdb convenience variable into gdb command Yakov Lerner
  2008-02-12 16:03 ` Daniel Jacobowitz
@ 2008-02-12 19:41 ` Michael Snyder
  2008-02-12 19:56   ` Daniel Jacobowitz
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2008-02-12 19:41 UTC (permalink / raw)
  To: Yakov Lerner; +Cc: gdb

On Tue, 2008-02-12 at 17:54 +0200, Yakov Lerner wrote:
> How do I substitute value of gdb convenience variable into gdb command ?
> 
> For example:
>     set $thread_num=5
>     thread apply $thread_num where
>     Error parsing $thread_num where
>     eval thread apply $thread_num where
>     Undefined command: "eval".  Try "help".
> 
> Thanks
> Y.L.


Hmm!  That's a bit of an oversight...
thread_apply_command calls strtol.  It ought to call
one of the built-in expression parsing functions.

Somebody should fix that...   ;-)




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: substitute gdb convenience variable into gdb command
  2008-02-12 19:41 ` Michael Snyder
@ 2008-02-12 19:56   ` Daniel Jacobowitz
  2008-02-12 22:17     ` Michael Snyder
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2008-02-12 19:56 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Yakov Lerner, gdb

On Tue, Feb 12, 2008 at 11:41:33AM -0800, Michael Snyder wrote:
> Hmm!  That's a bit of an oversight...
> thread_apply_command calls strtol.  It ought to call
> one of the built-in expression parsing functions.

Not really.  It would become pretty much impossible to parse the
command if you did that.  There's no reliable way to find the end of
an expression if it has unknown text afterwards.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: substitute gdb convenience variable into gdb command
  2008-02-12 16:03 ` Daniel Jacobowitz
@ 2008-02-12 22:09   ` Michael Snyder
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2008-02-12 22:09 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Yakov Lerner, gdb

On Tue, 2008-02-12 at 11:03 -0500, Daniel Jacobowitz wrote:
> On Tue, Feb 12, 2008 at 05:54:33PM +0200, Yakov Lerner wrote:
> > How do I substitute value of gdb convenience variable into gdb command ?
> 
> Sorry, there's no way to do this.

It's really dependent on the command.  Command arguments
come in as a string, and each command has to parse them.

It's just that in this particular case, the command tries
to parse the string by using strtol.  Nicer commands use
one of gdb's built-in parsing functions, which take into
account things like expressions and convenience variables.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: substitute gdb convenience variable into gdb command
  2008-02-12 19:56   ` Daniel Jacobowitz
@ 2008-02-12 22:17     ` Michael Snyder
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2008-02-12 22:17 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Yakov Lerner, gdb

On Tue, 2008-02-12 at 14:55 -0500, Daniel Jacobowitz wrote:
> On Tue, Feb 12, 2008 at 11:41:33AM -0800, Michael Snyder wrote:
> > Hmm!  That's a bit of an oversight...
> > thread_apply_command calls strtol.  It ought to call
> > one of the built-in expression parsing functions.
> 
> Not really.  It would become pretty much impossible to parse the
> command if you did that.  There's no reliable way to find the end of
> an expression if it has unknown text afterwards.

You're right.  I ran into the same issue when I did the
dump and restore commands.  I used parse_and_eval_long, 
but only because I arranged the command syntax so that
the integer value was the last argument on the command line.

In this case it isn't the last argument, so we can't do that.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-12 22:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-12 15:54 substitute gdb convenience variable into gdb command Yakov Lerner
2008-02-12 16:03 ` Daniel Jacobowitz
2008-02-12 22:09   ` Michael Snyder
2008-02-12 19:41 ` Michael Snyder
2008-02-12 19:56   ` Daniel Jacobowitz
2008-02-12 22:17     ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox