-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[lldb-dap] Add module symbol table viewer to VS Code extension #140626 #153836
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
Changes from 43 commits
9882d68
82430e3
5496e20
b5ee84e
9f17c74
bf6309a
c37369f
e76bb2f
738962f
de3ee14
f16d15b
262875c
e65178e
ae21288
023c7fa
bab7e01
2e48fdb
d8f17bc
68281f3
1ddd26b
c499355
0e668d0
b36db9a
de67bac
b6f6766
7c7f477
7c0ad87
6581b34
1f168a7
693e29c
f8da9f1
626ba0c
c4f59e4
012076c
024b566
6fccbaa
d61715e
f0fc40c
3aea6b6
1f3ae21
15fd62b
ca40bc1
300819c
30601fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -193,6 +193,14 @@ SymbolType SBSymbol::GetType() { | |||||||||
return eSymbolTypeInvalid; | ||||||||||
} | ||||||||||
|
||||||||||
uint32_t SBSymbol::GetID() { | ||||||||||
LLDB_INSTRUMENT_VA(this); | ||||||||||
|
||||||||||
if (m_opaque_ptr) | ||||||||||
return m_opaque_ptr->GetID(); | ||||||||||
return 0; | ||||||||||
} | ||||||||||
|
||||||||||
bool SBSymbol::IsExternal() { | ||||||||||
LLDB_INSTRUMENT_VA(this); | ||||||||||
|
||||||||||
|
@@ -208,3 +216,19 @@ bool SBSymbol::IsSynthetic() { | |||||||||
return m_opaque_ptr->IsSynthetic(); | ||||||||||
return false; | ||||||||||
} | ||||||||||
|
||||||||||
bool SBSymbol::IsDebug() { | ||||||||||
LLDB_INSTRUMENT_VA(this); | ||||||||||
|
||||||||||
if (m_opaque_ptr) | ||||||||||
return m_opaque_ptr->IsDebug(); | ||||||||||
return false; | ||||||||||
} | ||||||||||
|
||||||||||
const char *SBSymbol::GetTypeAsString(lldb::SymbolType symbol_type) { | ||||||||||
return Symbol::GetTypeAsString(symbol_type); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💯 |
||||||||||
} | ||||||||||
|
||||||||||
lldb::SymbolType SBSymbol::GetTypeFromString(const char *str) { | ||||||||||
return Symbol::GetTypeFromString(str); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💯 |
||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1570,6 +1570,18 @@ SBModule SBTarget::FindModule(const SBFileSpec &sb_file_spec) { | |||||
return sb_module; | ||||||
} | ||||||
|
||||||
SBModule SBTarget::FindModule(const SBModuleSpec &sb_module_spec) { | ||||||
LLDB_INSTRUMENT_VA(this, sb_module_spec); | ||||||
|
||||||
SBModule sb_module; | ||||||
if (TargetSP target_sp = GetSP(); target_sp && sb_module_spec.IsValid()) { | ||||||
// The module list is thread safe, no need to lock | ||||||
|
// The module list is thread safe, no need to lock | |
// The module list is thread safe, no need to lock. |
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.
💯
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
C_SOURCES := main.c | ||
|
||
include Makefile.rules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
Test lldb-dap moduleSymbols request | ||
""" | ||
|
||
import lldbdap_testcase | ||
|
||
|
||
class TestDAP_moduleSymbols(lldbdap_testcase.DAPTestCaseBase): | ||
def test_moduleSymbols(self): | ||
""" | ||
Test that the moduleSymbols request returns correct symbols from the module. | ||
""" | ||
program = self.getBuildArtifact("a.out") | ||
self.build_and_launch(program) | ||
|
||
symbol_names = [] | ||
i = 0 | ||
while True: | ||
next_symbol = self.dap_server.request_moduleSymbols( | ||
moduleName="a.out", startIndex=i, count=1 | ||
) | ||
self.assertIn("symbols", next_symbol["body"]) | ||
result_symbols = next_symbol["body"]["symbols"] | ||
self.assertLessEqual(len(result_symbols), 1) | ||
if len(result_symbols) == 0: | ||
break | ||
|
||
self.assertIn("name", result_symbols[0]) | ||
symbol_names.append(result_symbols[0]["name"]) | ||
i += 1 | ||
if i >= 1000: | ||
break | ||
|
||
self.assertGreater(len(symbol_names), 0) | ||
self.assertIn("main", symbol_names) | ||
self.assertIn("func1", symbol_names) | ||
self.assertIn("func2", symbol_names) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
int func1() { return 42; } | ||
|
||
int func2() { return 84; } | ||
|
||
int main() { | ||
func1(); | ||
func2(); | ||
return 0; | ||
} |
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.
please add a docstring
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.
💯