public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Undefine python command
@ 2011-03-31 19:28 Michel METZGER
  2011-03-31 19:46 ` Paul Koning
  2011-04-01 13:11 ` Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: Michel METZGER @ 2011-03-31 19:28 UTC (permalink / raw)
  To: gdb

Hi,

Is there a way to remove a commands defined in Python?
I need to define specific commands depending on the type of binary being debugged. It's not a problem for the first binary loaded, 
but if the user loads a new binary with 'file', I will need to remove some commands.

Thanks,

Michel.

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

* Re: Undefine python command
  2011-03-31 19:28 Undefine python command Michel METZGER
@ 2011-03-31 19:46 ` Paul Koning
  2011-03-31 20:10   ` Michel METZGER
  2011-04-01 13:11 ` Tom Tromey
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Koning @ 2011-03-31 19:46 UTC (permalink / raw)
  To: Michel METZGER; +Cc: gdb

"del" is the way.

def foo():
  print "hello world"

foo()
hello world
del foo
foo()
Traceback...
NameError: name 'foo' is not defined.

	paul

On Mar 31, 2011, at 3:27 PM, Michel METZGER wrote:

> Hi,
> 
> Is there a way to remove a commands defined in Python?
> I need to define specific commands depending on the type of binary being debugged. It's not a problem for the first binary loaded, 
> but if the user loads a new binary with 'file', I will need to remove some commands.
> 
> Thanks,
> 
> Michel.

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

* RE: Undefine python command
  2011-03-31 19:46 ` Paul Koning
@ 2011-03-31 20:10   ` Michel METZGER
  0 siblings, 0 replies; 4+ messages in thread
From: Michel METZGER @ 2011-03-31 20:10 UTC (permalink / raw)
  To: Paul Koning; +Cc: gdb

Apparently this doesn't work for gdb commands defined in python.
(Assuming I have a class HelloWorld that defines a new gdb command)


(gdb) python c = HelloWorld()
(gdb) hello-world
Hello, World!
(gdb) python del c
(gdb) hello-world
Hello, World!

Michel.

-----Original Message-----
From: Paul Koning [mailto:paul_koning@dell.com] 
Sent: Thursday, March 31, 2011 3:46 PM
To: Michel METZGER
Cc: gdb@sourceware.org
Subject: Re: Undefine python command

"del" is the way.

def foo():
  print "hello world"

foo()
hello world
del foo
foo()
Traceback...
NameError: name 'foo' is not defined.

	paul

On Mar 31, 2011, at 3:27 PM, Michel METZGER wrote:

> Hi,
> 
> Is there a way to remove a commands defined in Python?
> I need to define specific commands depending on the type of binary being debugged. It's not a problem for the first binary loaded, 
> but if the user loads a new binary with 'file', I will need to remove some commands.
> 
> Thanks,
> 
> Michel.

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

* Re: Undefine python command
  2011-03-31 19:28 Undefine python command Michel METZGER
  2011-03-31 19:46 ` Paul Koning
@ 2011-04-01 13:11 ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2011-04-01 13:11 UTC (permalink / raw)
  To: Michel METZGER; +Cc: gdb

Michel> Is there a way to remove a commands defined in Python?

No.

Michel> I need to define specific commands depending on the type of
Michel> binary being debugged. It's not a problem for the first binary
Michel> loaded, but if the user loads a new binary with 'file', I will
Michel> need to remove some commands.

You could make the commands error if they are invoked improperly.

Tom

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

end of thread, other threads:[~2011-04-01 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-31 19:28 Undefine python command Michel METZGER
2011-03-31 19:46 ` Paul Koning
2011-03-31 20:10   ` Michel METZGER
2011-04-01 13:11 ` Tom Tromey

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).