o lldbutil.py:
For the print_stacktrace(thread, string_buffer = False) function, if we have debug info
for a frame function, let's also emit the args for the current function.
o TestFrameUtils.py:
Add stronger assertTrue for frame0's args.
o TestPrintStackTraces.py:
Launch the inferior with ["abc", "xyz"] and expect '(int)argc=3' in the stack traces, since
by design the inferior is built with debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133204 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lldbutil.py b/test/lldbutil.py
index 94f6afd..e963ecd 100644
--- a/test/lldbutil.py
+++ b/test/lldbutil.py
@@ -387,11 +387,14 @@
load_addr = addrs[i].GetLoadAddress(target)
if not function:
file_addr = addrs[i].GetFileAddress()
- print >> output, " frame #{num}: {addr:#016x} {mod}`{symbol} + ????".format(
- num=i, addr=load_addr, mod=mods[i], symbol=symbols[i])
+ start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress()
+ symbol_offset = file_addr - start_addr
+ print >> output, " frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}".format(
+ num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset)
else:
- print >> output, " frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line}".format(
- num=i, addr=load_addr, mod=mods[i], func=funcs[i], file=files[i], line=lines[i])
+ print >> output, " frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}".format(
+ num=i, addr=load_addr, mod=mods[i], func=funcs[i], file=files[i], line=lines[i],
+ args=get_args_as_string(frame, showFuncName=False))
if string_buffer:
return output.getvalue()
@@ -429,7 +432,7 @@
# If we reach here, no parent has been found, return None.
return None
-def get_args_as_string(frame):
+def get_args_as_string(frame, showFuncName=True):
"""
Returns the args of the input frame object as a string.
"""
@@ -449,8 +452,11 @@
name = frame.GetSymbol().GetName()
else:
name = ""
- return "%s(%s)" % (name, ", ".join(args))
-
+ if showFuncName:
+ return "%s(%s)" % (name, ", ".join(args))
+ else:
+ return "(%s)" % (", ".join(args))
+
def print_registers(frame, string_buffer = False):
"""Prints all the register sets of the frame."""