Skip to content

🍒/austria/8e893dfed5f9+557a0e7b9668+8212b41b7b7d #4086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions lldb/source/Target/StopInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,19 +452,18 @@ class StopInfoBreakpoint : public StopInfo {

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

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

Debugger::ReportError(
std::move(error_message),
strm.GetString().str(),
exe_ctx.GetTargetRef().GetDebugger().GetID());
} else {
LLDB_LOGF(log,
Expand Down Expand Up @@ -861,20 +860,18 @@ class StopInfoWatchpoint : public StopInfo {
}
}
} else {
StreamSP error_sp = debugger.GetAsyncErrorStream();
error_sp->Printf(
"Stopped due to an error evaluating condition of watchpoint ");
wp_sp->GetDescription(error_sp.get(), eDescriptionLevelBrief);
error_sp->Printf(": \"%s\"", wp_sp->GetConditionText());
error_sp->EOL();
const char *err_str = error.AsCString("<Unknown Error>");
const char *err_str = error.AsCString("<unknown error>");
LLDB_LOGF(log, "Error evaluating condition: \"%s\"\n", err_str);

error_sp->PutCString(err_str);
error_sp->EOL();
error_sp->Flush();
// If the condition fails to be parsed or run, we should stop.
m_should_stop = true;
StreamString strm;
strm << "stopped due to an error evaluating condition of "
"watchpoint ";
wp_sp->GetDescription(&strm, eDescriptionLevelBrief);
strm << ": \"" << wp_sp->GetConditionText() << "\"\n";
strm << err_str;

Debugger::ReportError(strm.GetString().str(),
exe_ctx.GetTargetRef().GetDebugger().GetID());
}
}

Expand Down
5 changes: 5 additions & 0 deletions lldb/test/Shell/Breakpoint/invalid-condition.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# RUN: %clang_host %p/Inputs/dummy-target.c -o %t.out
# RUN: %lldb -b -o "br s -n main -c 'bogus'" -o "run" %t.out 2>&1 | FileCheck %s

# CHECK: error: stopped due to an error evaluating condition of breakpoint 1.1: "bogus"
# CHECK-NEXT: Couldn't parse conditional expression
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ disassemble --line
disassemble --frame
disassemble --pc
disassemble --address 0x4004
disassemble --address 0xdead
disassemble --count 7
disassemble --pc --count 7
11 changes: 8 additions & 3 deletions lldb/test/Shell/Commands/command-disassemble-process.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@

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

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

# RUN: %lldb -c %t %T/command-disassemble-process.exe \
# RUN: -o "settings set interpreter.stop-command-source-on-error false" \
# RUN: -o "disassemble --address 0xdead" -o exit 2>&1 \
# RUN: | FileCheck %s --check-prefix=INVALID

# CHECK: (lldb) disassemble
# CHECK-NEXT: command-disassemble-process.exe`main:
# CHECK-NEXT: 0x4002 <+0>: addb %al, (%rcx)
Expand Down Expand Up @@ -43,8 +48,6 @@
# CHECK-NEXT: -> 0x4004 <+2>: addb %al, (%rdx)
# CHECK-NEXT: 0x4006 <+4>: addb %al, (%rbx)
# CHECK-NEXT: 0x4008 <+6>: addb %al, (%rsi)
# CHECK-NEXT: (lldb) disassemble --address 0xdead
# CHECK-NEXT: error: Could not find function bounds for address 0xdead
# CHECK-NEXT: (lldb) disassemble --count 7
# CHECK-NEXT: command-disassemble-process.exe`main:
# CHECK-NEXT: 0x4002 <+0>: addb %al, (%rcx)
Expand All @@ -64,6 +67,8 @@
# CHECK-NEXT: 0x400e: addb %cl, (%rcx)
# CHECK-NEXT: 0x4010: addb %cl, (%rdx)

# INVALID: error: Could not find function bounds for address 0xdead

# 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.

--- !ELF
Expand Down
6 changes: 4 additions & 2 deletions lldb/test/Shell/Minidump/no-process-id.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# RUN: yaml2obj %s -o %t
# RUN: %lldb -c %t -o "thread list" -o "register read" -b 2>&1 | FileCheck %s
# RUN: %lldb -c %t -o "thread list" -o "register read" -b 2> %t.stderr | FileCheck %s

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

# CHECK: (lldb) thread list
Expand All @@ -12,6 +11,9 @@
# CHECK: (lldb) register read
# CHECK: rsp = 0x00007ffceb34a210

# RUN: cat %t.stderr | FileCheck %s --check-prefix ERROR
# ERROR: unable to retrieve process ID from minidump file, setting process ID to 1

--- !minidump
Streams:
- Type: ThreadList
Expand Down