[Lldb-commits] [lldb] r155528 - in /lldb/trunk: examples/darwin/heap_find/heap.py examples/python/crashlog.py scripts/Python/finish-swig-Python-LLDB.sh source/Interpreter/ScriptInterpreterPython.cpp
Greg Clayton
gclayton at apple.com
Tue Apr 24 18:49:51 PDT 2012
Author: gclayton
Date: Tue Apr 24 20:49:50 2012
New Revision: 155528
URL: http://llvm.org/viewvc/llvm-project?rev=155528&view=rev
Log:
Now that we have an LLDB package, make the "lldb.macosx.crashlog" module work with all of the new module paths.
Modified:
lldb/trunk/examples/darwin/heap_find/heap.py
lldb/trunk/examples/python/crashlog.py
lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
Modified: lldb/trunk/examples/darwin/heap_find/heap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap.py?rev=155528&r1=155527&r2=155528&view=diff
==============================================================================
--- lldb/trunk/examples/darwin/heap_find/heap.py (original)
+++ lldb/trunk/examples/darwin/heap_find/heap.py Tue Apr 24 20:49:50 2012
@@ -20,14 +20,15 @@
import optparse
import os
import shlex
-import symbolication # from lldb/examples/python/symbolication.py
+import lldb.utils.symbolication
def load_dylib():
if lldb.target:
python_module_directory = os.path.dirname(__file__)
- libheap_dylib_path = python_module_directory + '/libheap.dylib'
+ heap_code_directory = python_module_directory + '/heap'
+ libheap_dylib_path = heap_code_directory + '/heap/libheap.dylib'
if not os.path.exists(libheap_dylib_path):
- make_command = '(cd "%s" ; make)' % python_module_directory
+ make_command = '(cd "%s" ; make)' % heap_code_directory
print make_command
print commands.getoutput(make_command)
if os.path.exists(libheap_dylib_path):
@@ -172,7 +173,7 @@
lldb.debugger.GetCommandInterpreter().HandleCommand(memory_command, cmd_result)
print cmd_result.GetOutput()
if options.stack:
- symbolicator = symbolication.Symbolicator()
+ symbolicator = lldb.utils.symbolication.Symbolicator()
symbolicator.target = lldb.target
expr_str = "g_stack_frames_count = sizeof(g_stack_frames)/sizeof(uint64_t); (int)__mach_stack_logging_get_frames((unsigned)mach_task_self(), 0x%xull, g_stack_frames, g_stack_frames_count, &g_stack_frames_count)" % (malloc_addr)
#print expr_str
Modified: lldb/trunk/examples/python/crashlog.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=155528&r1=155527&r2=155528&view=diff
==============================================================================
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Tue Apr 24 20:49:50 2012
@@ -37,7 +37,7 @@
import sys
import time
import uuid
-import symbolication
+import lldb.utils.symbolication
PARSE_MODE_NORMAL = 0
PARSE_MODE_THREAD = 1
@@ -45,7 +45,7 @@
PARSE_MODE_THREGS = 3
PARSE_MODE_SYSTEM = 4
-class CrashLog(symbolication.Symbolicator):
+class CrashLog(lldb.utils.symbolication.Symbolicator):
"""Class that does parses darwin crash logs"""
thread_state_regex = re.compile('^Thread ([0-9]+) crashed with')
thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
@@ -97,7 +97,7 @@
else:
return "[%3u] 0x%16.16x" % (self.index, self.pc)
- class DarwinImage(symbolication.Image):
+ class DarwinImage(lldb.utils.symbolication.Image):
"""Class that represents a binary images in a darwin crash log"""
dsymForUUIDBinary = os.path.expanduser('~rc/bin/dsymForUUID')
if not os.path.exists(dsymForUUIDBinary):
@@ -106,8 +106,8 @@
dwarfdump_uuid_regex = re.compile('UUID: ([-0-9a-fA-F]+) \(([^\(]+)\) .*')
def __init__(self, text_addr_lo, text_addr_hi, identifier, version, uuid, path):
- symbolication.Image.__init__(self, path, uuid);
- self.add_section (symbolication.Section(text_addr_lo, text_addr_hi, "__TEXT"))
+ lldb.utils.symbolication.Image.__init__(self, path, uuid);
+ self.add_section (lldb.utils.symbolication.Section(text_addr_lo, text_addr_hi, "__TEXT"))
self.identifier = identifier
self.version = version
@@ -158,7 +158,7 @@
def __init__(self, path):
"""CrashLog constructor that take a path to a darwin crash log file"""
- symbolication.Symbolicator.__init__(self);
+ lldb.utils.symbolication.Symbolicator.__init__(self);
self.path = os.path.expanduser(path);
self.info_lines = list()
self.system_profile = list()
@@ -313,7 +313,7 @@
def create_target(self):
#print 'crashlog.create_target()...'
- target = symbolication.Symbolicator.create_target(self)
+ target = lldb.utils.symbolication.Symbolicator.create_target(self)
if target:
return target
# We weren't able to open the main executable as, but we can still symbolicate
@@ -446,11 +446,11 @@
instructions = symbolicated_frame_address.get_instructions()
if instructions:
print
- symbolication.disassemble_instructions (target,
- instructions,
- frame.pc,
- options.disassemble_before,
- options.disassemble_after, frame.index > 0)
+ lldb.utils.symbolication.disassemble_instructions (target,
+ instructions,
+ frame.pc,
+ options.disassemble_before,
+ options.disassemble_after, frame.index > 0)
print
symbolicated_frame_address_idx += 1
else:
@@ -467,6 +467,6 @@
lldb.debugger = lldb.SBDebugger.Create()
SymbolicateCrashLog (sys.argv[1:])
elif lldb.debugger:
- lldb.debugger.HandleCommand('command script add -f crashlog.Symbolicate crashlog')
+ lldb.debugger.HandleCommand('command script add -f lldb.macosx.crashlog.Symbolicate crashlog')
print '"crashlog" command installed, type "crashlog --help" for detailed help'
Modified: lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh?rev=155528&r1=155527&r2=155528&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh Tue Apr 24 20:49:50 2012
@@ -240,12 +240,24 @@
package_files="${SRC_ROOT}/examples/python/symbolication.py"
create_python_package "/utils" "${package_files}"
-# lldb/macosx
-package_files="${SRC_ROOT}/examples/python/crashlog.py
-${SRC_ROOT}/examples/darwin/heap_find/heap.py"
-create_python_package "/macosx" "${package_files}"
+if [ ${OS_NAME} == "Darwin" ]
+then
+ # lldb/macosx
+ package_files="${SRC_ROOT}/examples/python/crashlog.py
+ ${SRC_ROOT}/examples/darwin/heap_find/heap.py"
+ create_python_package "/macosx" "${package_files}"
+ # Copy files needed by lldb/macosx/heap.py to build libheap.dylib
+ heap_dir="${framework_python_dir}/macosx/heap"
+ if [ ! -d "${heap_dir}" ]
+ then
+ mkdir -p "${heap_dir}"
+ cp "${SRC_ROOT}/examples/darwin/heap_find/heap/heap_find.cpp" "${heap_dir}"
+ cp "${SRC_ROOT}/examples/darwin/heap_find/heap/Makefile" "${heap_dir}"
+ fi
+fi
fi
+
exit 0
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=155528&r1=155527&r2=155528&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Tue Apr 24 20:49:50 2012
@@ -534,7 +534,7 @@
if (script_interpreter_dict != NULL)
{
PyObject *pfunc = (PyObject*)m_run_one_line;
- PyObject *pmod = PyImport_AddModule ("embedded_interpreter");
+ PyObject *pmod = PyImport_AddModule ("lldb.embedded_interpreter");
if (pmod != NULL)
{
PyObject *pmod_dict = PyModule_GetDict (pmod);
More information about the lldb-commits
mailing list