Skip to content

Commit 305475e

Browse files
authored
Merge pull request #4086 from apple/πŸ’/austria/8e893dfed5f9+557a0e7b9668+8212b41b7b7d
πŸ’/austria/8e893dfed5f9+557a0e7b9668+8212b41b7b7d
2 parents 5f897e5 + e8d31af commit 305475e

File tree

5 files changed

+35
-27
lines changed

5 files changed

+35
-27
lines changed

β€Žlldb/source/Target/StopInfo.cpp

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -452,19 +452,18 @@ class StopInfoBreakpoint : public StopInfo {
452452

453453
if (!condition_error.Success()) {
454454
const char *err_str =
455-
condition_error.AsCString("<Unknown Error>");
455+
condition_error.AsCString("<unknown error>");
456456
LLDB_LOGF(log, "Error evaluating condition: \"%s\"\n", err_str);
457457

458-
std::string error_message;
459-
llvm::raw_string_ostream os(error_message);
460-
os << "stopped due to an error evaluating condition of "
461-
"breakpoint "
462-
<< bp_loc_sp->GetConditionText() << '\n';
463-
os << err_str;
464-
os.flush();
458+
StreamString strm;
459+
strm << "stopped due to an error evaluating condition of "
460+
"breakpoint ";
461+
bp_loc_sp->GetDescription(&strm, eDescriptionLevelBrief);
462+
strm << ": \"" << bp_loc_sp->GetConditionText() << "\"\n";
463+
strm << err_str;
465464

466465
Debugger::ReportError(
467-
std::move(error_message),
466+
strm.GetString().str(),
468467
exe_ctx.GetTargetRef().GetDebugger().GetID());
469468
} else {
470469
LLDB_LOGF(log,
@@ -861,20 +860,18 @@ class StopInfoWatchpoint : public StopInfo {
861860
}
862861
}
863862
} else {
864-
StreamSP error_sp = debugger.GetAsyncErrorStream();
865-
error_sp->Printf(
866-
"Stopped due to an error evaluating condition of watchpoint ");
867-
wp_sp->GetDescription(error_sp.get(), eDescriptionLevelBrief);
868-
error_sp->Printf(": \"%s\"", wp_sp->GetConditionText());
869-
error_sp->EOL();
870-
const char *err_str = error.AsCString("<Unknown Error>");
863+
const char *err_str = error.AsCString("<unknown error>");
871864
LLDB_LOGF(log, "Error evaluating condition: \"%s\"\n", err_str);
872865

873-
error_sp->PutCString(err_str);
874-
error_sp->EOL();
875-
error_sp->Flush();
876-
// If the condition fails to be parsed or run, we should stop.
877-
m_should_stop = true;
866+
StreamString strm;
867+
strm << "stopped due to an error evaluating condition of "
868+
"watchpoint ";
869+
wp_sp->GetDescription(&strm, eDescriptionLevelBrief);
870+
strm << ": \"" << wp_sp->GetConditionText() << "\"\n";
871+
strm << err_str;
872+
873+
Debugger::ReportError(strm.GetString().str(),
874+
exe_ctx.GetTargetRef().GetDebugger().GetID());
878875
}
879876
}
880877

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# RUN: %clang_host %p/Inputs/dummy-target.c -o %t.out
2+
# RUN: %lldb -b -o "br s -n main -c 'bogus'" -o "run" %t.out 2>&1 | FileCheck %s
3+
4+
# CHECK: error: stopped due to an error evaluating condition of breakpoint 1.1: "bogus"
5+
# CHECK-NEXT: Couldn't parse conditional expression

β€Žlldb/test/Shell/Commands/Inputs/command-disassemble-process.lldbinit

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ disassemble --line
33
disassemble --frame
44
disassemble --pc
55
disassemble --address 0x4004
6-
disassemble --address 0xdead
76
disassemble --count 7
87
disassemble --pc --count 7

β€Žlldb/test/Shell/Commands/command-disassemble-process.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@
66

77
# RUN: %lldb -c %t %T/command-disassemble-process.exe \
88
# RUN: -o "settings set interpreter.stop-command-source-on-error false" \
9-
# RUN: -s %S/Inputs/command-disassemble-process.lldbinit -o exit 2>&1 \
9+
# RUN: -s %S/Inputs/command-disassemble-process.lldbinit -o exit \
1010
# RUN: | FileCheck %s
1111

1212
# RUN: %lldb -c %t %T/command-disassemble-process.big.exe \
1313
# RUN: -o "settings set stop-disassembly-max-size 8000" \
1414
# RUN: -o disassemble -o exit 2>&1 | FileCheck %s --check-prefix=BIG
1515

16+
# RUN: %lldb -c %t %T/command-disassemble-process.exe \
17+
# RUN: -o "settings set interpreter.stop-command-source-on-error false" \
18+
# RUN: -o "disassemble --address 0xdead" -o exit 2>&1 \
19+
# RUN: | FileCheck %s --check-prefix=INVALID
20+
1621
# CHECK: (lldb) disassemble
1722
# CHECK-NEXT: command-disassemble-process.exe`main:
1823
# CHECK-NEXT: 0x4002 <+0>: addb %al, (%rcx)
@@ -43,8 +48,6 @@
4348
# CHECK-NEXT: -> 0x4004 <+2>: addb %al, (%rdx)
4449
# CHECK-NEXT: 0x4006 <+4>: addb %al, (%rbx)
4550
# CHECK-NEXT: 0x4008 <+6>: addb %al, (%rsi)
46-
# CHECK-NEXT: (lldb) disassemble --address 0xdead
47-
# CHECK-NEXT: error: Could not find function bounds for address 0xdead
4851
# CHECK-NEXT: (lldb) disassemble --count 7
4952
# CHECK-NEXT: command-disassemble-process.exe`main:
5053
# CHECK-NEXT: 0x4002 <+0>: addb %al, (%rcx)
@@ -64,6 +67,8 @@
6467
# CHECK-NEXT: 0x400e: addb %cl, (%rcx)
6568
# CHECK-NEXT: 0x4010: addb %cl, (%rdx)
6669

70+
# INVALID: error: Could not find function bounds for address 0xdead
71+
6772
# BIG: error: Not disassembling the current function because it is very large [0x0000000000004002-0x0000000000005f42). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
6873

6974
--- !ELF

β€Žlldb/test/Shell/Minidump/no-process-id.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# RUN: yaml2obj %s -o %t
2-
# RUN: %lldb -c %t -o "thread list" -o "register read" -b 2>&1 | FileCheck %s
2+
# RUN: %lldb -c %t -o "thread list" -o "register read" -b 2> %t.stderr | FileCheck %s
33

44
# CHECK: (lldb) target create --core
5-
# CHECK: unable to retrieve process ID from minidump file, setting process ID to 1
65
# CHECK: Core file {{.*}} was loaded.
76

87
# CHECK: (lldb) thread list
@@ -12,6 +11,9 @@
1211
# CHECK: (lldb) register read
1312
# CHECK: rsp = 0x00007ffceb34a210
1413

14+
# RUN: cat %t.stderr | FileCheck %s --check-prefix ERROR
15+
# ERROR: unable to retrieve process ID from minidump file, setting process ID to 1
16+
1517
--- !minidump
1618
Streams:
1719
- Type: ThreadList

0 commit comments

Comments
Β (0)