1 //===-- plugin.cpp -------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 An example plugin for LLDB that provides a new foo command with a child subcommand
12 Compile this into a dylib foo.dylib and load by placing in appropriate locations on disk or
13 by typing plugin load foo.dylib at the LLDB command line
20 PluginInitialize (lldb::SBDebugger debugger);
23 class ChildCommand : public lldb::SBCommandPluginInterface
27 DoExecute (lldb::SBDebugger debugger,
29 lldb::SBCommandReturnObject &result)
33 const char* arg = *command;
36 result.Printf("%s ",arg);
48 lldb::PluginInitialize (lldb::SBDebugger debugger)
50 lldb::SBCommandInterpreter interpreter = debugger.GetCommandInterpreter();
51 lldb::SBCommand foo = interpreter.AddMultiwordCommand("plugin_loaded_command",NULL);
52 foo.AddCommand("child",new ChildCommand(),"a child of plugin_loaded_command");