[lldb-vscode] Fix TestVSCode_module

For some reason this works on the original author's machine, but not on my. So I'm using a safer approach of using an unstripped dynamic library to place breakpoints on. The author was placing a breakpoint on the main symbol of a stripped library and for some reason it worked on their machine, but it shouldn't have...

Offender diff: D82477
This commit is contained in:
Walter Erquinigo 2020-07-10 16:32:22 -07:00
parent 03ef61033f
commit 881af6eb00
5 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,8 @@
DYLIB_NAME := foo
DYLIB_CXX_SOURCES := foo.cpp
CXX_SOURCES := main.cpp
all: a.out.stripped
all: a.out.stripped
include Makefile.rules
@ -8,4 +10,4 @@ a.out.stripped: a.out.dSYM
strip -o a.out.stripped a.out
ifneq "$(CODESIGN)" ""
$(CODESIGN) -fs - a.out.stripped
endif
endif

View File

@ -20,9 +20,7 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
program_basename = "a.out.stripped"
program= self.getBuildArtifact(program_basename)
self.build_and_launch(program)
source = "main.cpp"
main_source_path = self.getSourcePath(source)
functions = ['main']
functions = ['foo']
breakpoint_ids = self.set_function_breakpoints(functions)
self.assertEquals(len(breakpoint_ids), len(functions),
'expect one breakpoint')
@ -37,7 +35,7 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
self.assertTrue('symbolFilePath' not in program_module, 'Make sure a.out.stripped has no debug info')
self.assertEqual('Symbols not found.', program_module['symbolStatus'])
symbol_path = self.getBuildArtifact("a.out")
response = self.vscode.request_evaluate('`%s' % ('target symbols add -s "%s" "%s"' % (program, symbol_path)))
self.vscode.request_evaluate('`%s' % ('target symbols add -s "%s" "%s"' % (program, symbol_path)))
active_modules = self.vscode.get_active_modules()
program_module = active_modules[program_basename]
self.assertEqual(program_basename, program_module['name'])

View File

@ -0,0 +1,3 @@
int foo() {
return 12;
}

View File

@ -0,0 +1 @@
int foo();

View File

@ -1,3 +1,6 @@
#include "foo.h"
int main(int argc, char const *argv[]) {
foo();
return 0; // breakpoint 1
}