Author: Walter Erquinigo
Date: 2020-07-10T16:50:59-07:00
New Revision: 881af6eb0030986876d3b80668193e5c3c04a87c

URL: 
https://github.com/llvm/llvm-project/commit/881af6eb0030986876d3b80668193e5c3c04a87c
DIFF: 
https://github.com/llvm/llvm-project/commit/881af6eb0030986876d3b80668193e5c3c04a87c.diff

LOG: [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

Added: 
    lldb/test/API/tools/lldb-vscode/module/foo.cpp
    lldb/test/API/tools/lldb-vscode/module/foo.h

Modified: 
    lldb/test/API/tools/lldb-vscode/module/Makefile
    lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
    lldb/test/API/tools/lldb-vscode/module/main.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/tools/lldb-vscode/module/Makefile 
b/lldb/test/API/tools/lldb-vscode/module/Makefile
index 04c9fda1c388..1fb944b13893 100644
--- a/lldb/test/API/tools/lldb-vscode/module/Makefile
+++ b/lldb/test/API/tools/lldb-vscode/module/Makefile
@@ -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
\ No newline at end of file
+endif

diff  --git a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py 
b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
index 1de461ef9efa..1a5cadb22bc6 100644
--- a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
+++ b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
@@ -20,9 +20,7 @@ def test_modules_event(self):
         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 @@ def test_modules_event(self):
         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'])

diff  --git a/lldb/test/API/tools/lldb-vscode/module/foo.cpp 
b/lldb/test/API/tools/lldb-vscode/module/foo.cpp
new file mode 100644
index 000000000000..9dba85a9ccca
--- /dev/null
+++ b/lldb/test/API/tools/lldb-vscode/module/foo.cpp
@@ -0,0 +1,3 @@
+int foo() {
+    return 12;
+}

diff  --git a/lldb/test/API/tools/lldb-vscode/module/foo.h 
b/lldb/test/API/tools/lldb-vscode/module/foo.h
new file mode 100644
index 000000000000..5d5f8f0c9e78
--- /dev/null
+++ b/lldb/test/API/tools/lldb-vscode/module/foo.h
@@ -0,0 +1 @@
+int foo();

diff  --git a/lldb/test/API/tools/lldb-vscode/module/main.cpp 
b/lldb/test/API/tools/lldb-vscode/module/main.cpp
index 62bcb78696b0..4ff2b2360eb9 100644
--- a/lldb/test/API/tools/lldb-vscode/module/main.cpp
+++ b/lldb/test/API/tools/lldb-vscode/module/main.cpp
@@ -1,3 +1,6 @@
+#include "foo.h"
+
 int main(int argc, char const *argv[]) {
+  foo();
   return 0; // breakpoint 1
 }


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to