diff options
author | Enrico Granata <granata.enrico@gmail.com> | 2011-10-17 21:45:27 +0000 |
---|---|---|
committer | Enrico Granata <granata.enrico@gmail.com> | 2011-10-17 21:45:27 +0000 |
commit | a9dbf4325e9b97ca4c68baf4d05fad55bd194332 (patch) | |
tree | fc59812edc526ec91c28e8fbddc6ca5c32e1833b /lldb/test/functionalities/command_script/import/bar | |
parent | a5748e22e2c997ae5fbe4aa3b9170e7a12375e26 (diff) | |
download | bcm5719-llvm-a9dbf4325e9b97ca4c68baf4d05fad55bd194332.tar.gz bcm5719-llvm-a9dbf4325e9b97ca4c68baf4d05fad55bd194332.zip |
this patch introduces a new command script import command which takes as input a filename for a Python script and imports the module contained in that file. the containing directory is added to the Python path such that dependencies are honored. also, the module may contain an __lldb_init_module(debugger,dict) function, which gets called after importing, and which can somehow initialize the module's interaction with lldb
llvm-svn: 142283
Diffstat (limited to 'lldb/test/functionalities/command_script/import/bar')
-rw-r--r-- | lldb/test/functionalities/command_script/import/bar/bar.py | 10 | ||||
-rw-r--r-- | lldb/test/functionalities/command_script/import/bar/barutil.py | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lldb/test/functionalities/command_script/import/bar/bar.py b/lldb/test/functionalities/command_script/import/bar/bar.py new file mode 100644 index 00000000000..269fc935204 --- /dev/null +++ b/lldb/test/functionalities/command_script/import/bar/bar.py @@ -0,0 +1,10 @@ +def bar_function(debugger, args, result, dict): + global UtilityModule + result.Printf(UtilityModule.barutil_function("bar told me " + args)) + return None + +def __lldb_init_module(debugger, session_dict): + global UtilityModule + UtilityModule = __import__("barutil") + debugger.HandleCommand("command script add -f bar.bar_function barothercmd") + return None
\ No newline at end of file diff --git a/lldb/test/functionalities/command_script/import/bar/barutil.py b/lldb/test/functionalities/command_script/import/bar/barutil.py new file mode 100644 index 00000000000..0d3d2eb1b2d --- /dev/null +++ b/lldb/test/functionalities/command_script/import/bar/barutil.py @@ -0,0 +1,2 @@ +def barutil_function(x): + return "barutil says: " + x |