-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[LLDB] Check comp_unit before accessing it in DIL #147955
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
Conversation
|
The other thing I noticed is that watchpoint command doesn't expect |
|
@llvm/pr-subscribers-lldb Author: Ilia Kuklin (kuilpd) ChangesCheck Full diff: https://github.com/llvm/llvm-project/pull/147955.diff 1 Files Affected:
diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp
index 8ca9b4215985d..fd3f9f8724608 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -50,8 +50,9 @@ lldb::ValueObjectSP LookupGlobalIdentifier(
// Get a global variables list without the locals from the current frame
SymbolContext symbol_context =
stack_frame->GetSymbolContext(lldb::eSymbolContextCompUnit);
- lldb::VariableListSP variable_list =
- symbol_context.comp_unit->GetVariableList(true);
+ lldb::VariableListSP variable_list;
+ if (symbol_context.comp_unit)
+ variable_list = symbol_context.comp_unit->GetVariableList(true);
name_ref.consume_front("::");
lldb::ValueObjectSP value_sp;
|
|
It's pretty much an accident we hit this in the test suite. Could you create a dedicated test for this. I guess the scenario is "running 'frame var' in a frame without debug info" (?) |
No debug information at all? Or test the same |
|
No debug info in the currently selected frame. Or at least, I think so, based on looking at the code you're fixing. You can verify that by checking whether the current code crashes in that scenario. I'm right, it should be sufficient to build one file with -g0.
|
|
Added a test without debug info and you're right, it fails without this fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks.
I'm not totally sure about our ability to break on symbols with no debug info on all platforms (particularly, windows). If this fails somewhere, you can use work around this by putting a breakpoint in a file with debug info, then doing an up to a frame/file with no debug info, and evaluating the expressions there. You can use this syntax to build a single file with no debug info:
| Point.o: CFLAGS_EXTRAS += -g0 |
Check
symbol_context.comp_unitbefore accessing it to avoidnullptrdereferencing.