Use a more backwards-compatible method for evaluating expressions and add
more explanatory error messages.
llvm-svn: 190215
GitOrigin-RevId: 5ef1c861ddef5568c8c5596325048655a808c383
diff --git a/llgdb.py b/llgdb.py
index bfa5fb1..40f7e36 100644
--- a/llgdb.py
+++ b/llgdb.py
@@ -79,7 +79,7 @@
if not cmd:
continue
- print '> %s'% command
+ print '> %s'% command[:-1]
try:
if re.match('^r|(run)$', cmd[0]):
@@ -87,11 +87,17 @@
launchinfo = lldb.SBLaunchInfo([])
launchinfo.SetWorkingDirectory(os.getcwd())
process = target.Launch(launchinfo, error)
+ print error
if not process or error.fail:
- print error
state = process.GetState()
print "State = %d" % state
- print "Could not launch process."
+ print """
+ERROR: Could not launch process.
+NOTE: There are several resons why this may happen:
+ * Root needs to run "DevToolsSecurity --enable".
+ * We launched ("run") more than one process simultaneously.
+ (cf. rdar://problem/14929651)
+"""
sys.exit(1)
elif re.match('^b|(break)$', cmd[0]) and len(cmd) == 2:
@@ -101,7 +107,7 @@
print target.BreakpointCreateByLocation(mainfile, int(cmd[1]))
else:
# b file:line
- file, line = cmd.split(':')
+ file, line = cmd[1].split(':')
print target.BreakpointCreateByLocation(file, int(line))
elif re.match('^ptype$', cmd[0]) and len(cmd) == 2:
@@ -122,8 +128,9 @@
print target.EvaluateExpression(' '.join(cmd[1:]), opts)
elif re.match('^p|(print)$', cmd[0]) and len(cmd) > 1:
- opts = lldb.SBExpressionOptions()
- print target.EvaluateExpression(' '.join(cmd[1:]), opts)
+ thread = process.GetThreadAtIndex(0)
+ frame = thread.GetFrameAtIndex(0)
+ print frame.EvaluateExpression(' '.join(cmd[1:]))
elif re.match('^q|(quit)$', cmd[0]):
sys.exit(0)
diff --git a/static-member.cpp b/static-member.cpp
index 7512331..66191e7 100644
--- a/static-member.cpp
+++ b/static-member.cpp
@@ -7,7 +7,7 @@
// DEBUGGER: break static-member.cpp:33
// DEBUGGER: r
// DEBUGGER: ptype C
-// CHECK: type = {{struct|class}} C {
+// CHECK: {{struct|class}} C {
// CHECK: static const int a;
// CHECK-NEXT: static int b;
// CHECK-NEXT: static int c;