Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Need help with GDB commands
@ 2001-07-03 12:01 Harald Fernengel
  2001-07-03 23:51 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Harald Fernengel @ 2001-07-03 12:01 UTC (permalink / raw)
  To: gdb

Hello,

Is there a way to determine whether Class x has a member variable y at GDB 
runtime?

I want to create a script like:

define printmember
    if exists (x.y) output x.y
    .....
end

In other words: How can I get rid of that "No symbol y in current context" 
and just output the right member?

Harry


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

* Re: Need help with GDB commands
  2001-07-03 12:01 Need help with GDB commands Harald Fernengel
@ 2001-07-03 23:51 ` Eli Zaretskii
  2001-07-03 23:56   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2001-07-03 23:51 UTC (permalink / raw)
  To: Harald Fernengel; +Cc: gdb

On Tue, 3 Jul 2001, Harald Fernengel wrote:

> I need to create a user-defined command that reads some memory and then
> passes it a formatting program.  I am assuming the formatting program would
> be run via the 'shell' command'.  Is there any way to do this?
> 
> Below is a list of the things that I have thought of.  None of them seem to
> be possible:
> 
> * Writing the command output to a file (this is my preferred approach)
> * Passing output as stdin to a child process
> * Setting an environment variable which contains the output
> * Passing output as command line parameters to a child process

I'd suggest

 * add a special function to the debuggee which will accept the
   command line for the formatting program, and then run that
   program.  Then use the GDB `call' command to invoke that function
   from GDB.

> Another possible solution would be to call C runtime I/O functions as part
> an expression in a 'set' command.  However, these functions would be
> running on the target, not the gdb host machine right?

Ah, you are debugging a remote target?  Than my suggestion won't work
for you.

Sounds like a good reason for extending `shell', or maybe for a new
command.


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

* Re: Need help with GDB commands
  2001-07-03 23:51 ` Eli Zaretskii
@ 2001-07-03 23:56   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2001-07-03 23:56 UTC (permalink / raw)
  To: Harald Fernengel, gdb

On Wed, 4 Jul 2001, I wrote:

> On Tue, 3 Jul 2001, Harald Fernengel wrote:

Sorry, I replied to the wrong message.


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

end of thread, other threads:[~2001-07-03 23:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-03 12:01 Need help with GDB commands Harald Fernengel
2001-07-03 23:51 ` Eli Zaretskii
2001-07-03 23:56   ` Eli Zaretskii

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