summaryrefslogtreecommitdiff
path: root/misc/lldb_rb/commands/command_template.py
blob: 21014a993e4d71bea207768c687943e7efc84c37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This is a command template for implementing a helper function inside LLDB. To
# use this file
#   1. Copy it and rename the copy so it ends with `_command.py`.
#   2. Rename the class to something descriptive that ends with Command.
#   3. Change the program variable to be a descriptive command name
#   4. Ensure you are inheriting from RbBaseCommand or another command that
#      implements the same interface

import lldb

from lldb_rb.constants import *
from lldb_rb.rb_base_command import RbBaseCommand

# This test command inherits from RbBaseCommand which provides access to Ruby
# globals and utility helpers
class TestCommand(RbBaseCommand):
    # program is the keyword the user will type in lldb to execute this command
    program = "test"

    # help_string will be displayed in lldb when the user uses the help functions
    help_string = "This is a test command to show how to implement lldb commands"

    # call is where our command logic will be implemented
    def call(self, debugger, command, exe_ctx, result):
        # This method will be called once the LLDB environment has been setup.
        # You will have access to self.target, self.process, self.frame, and
        # self.thread
        #
        # This is where we should implement our command logic
        pass