[Lldb-commits] [PATCH] D57830: Add functionality to trace a function within lldb

Aditya Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 6 11:05:43 PST 2019


hiraditya created this revision.
hiraditya added reviewers: xiaobai, clayborg.
Herald added a reviewer: serge-sans-paille.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57830

Files:
  examples/python/process_events.py


Index: examples/python/process_events.py
===================================================================
--- examples/python/process_events.py
+++ examples/python/process_events.py
@@ -184,6 +184,12 @@
         help='Specify the timeout in seconds to wait for process state change events.',
         default=lldb.UINT32_MAX)
     parser.add_option(
+        '-f',
+        '--trace-function',
+        type='string',
+        dest='trace_function',
+        help='Trace a function during execution, Warning: tracing is really slow.')
+    parser.add_option(
         '-e',
         '--environment',
         action='append',
@@ -275,6 +281,9 @@
             for bp in options.breakpoints:
                 debugger.HandleCommand("_regexp-break %s" % (bp))
             run_commands(command_interpreter, ['breakpoint list'])
+        if launch_info and options.trace_function:
+            debugger.HandleCommand("_regexp-break &%s" % (options.trace_function))
+            run_commands(command_interpreter, ['breakpoint list'])
 
         for run_idx in range(options.run_count):
             # Launch the process. Since we specified synchronous mode, we won't return
@@ -348,7 +357,10 @@
                                     stop_idx += 1
                                     print_threads(process, options)
                                     print "continuing process %u" % (pid)
-                                    process.Continue()
+                                    if options.trace_function:
+                                        process.GetThreadAtIndex(0).StepInto()
+                                    else:
+                                        process.Continue()
                                 elif state == lldb.eStateExited:
                                     exit_desc = process.GetExitDescription()
                                     if exit_desc:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57830.185596.patch
Type: text/x-patch
Size: 1886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190206/1302d395/attachment.bin>


More information about the lldb-commits mailing list