Skip to content

Instantly share code, notes, and snippets.

@davidfooks
Created January 12, 2017 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidfooks/f88f397f809bd152ec7b676d412274dd to your computer and use it in GitHub Desktop.
Save davidfooks/f88f397f809bd152ec7b676d412274dd to your computer and use it in GitHub Desktop.
Example gdb command in python
print("Loaded python script!")
import gdb
class HelloWorldCommand (gdb.Command):
"MyCommand! yay."
def __init__ (self):
super(HelloWorldCommand, self).__init__("helloworld", gdb.COMMAND_USER, gdb.COMPLETE_NONE, True)
def invoke(self, arg, from_tty):
print("Hello world")
print(str(arg))
print(str(from_tty))
HelloWorldCommand()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment