File tree 3 files changed +24
-5
lines changed
packages/Python/lldbsuite/test/tools/lldb-dap
test/API/tools/lldb-dap/launch
3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -851,7 +851,7 @@ def request_launch(
851
851
args_dict ["debuggerRoot" ] = debuggerRoot
852
852
if launchCommands :
853
853
args_dict ["launchCommands" ] = launchCommands
854
- if sourceMap :
854
+ if sourceMap is not None : # sourceMap can be empty array.
855
855
args_dict ["sourceMap" ] = sourceMap
856
856
if runInTerminal :
857
857
args_dict ["runInTerminal" ] = runInTerminal
Original file line number Diff line number Diff line change @@ -99,6 +99,24 @@ def test_stopOnEntry(self):
99
99
reason , "breakpoint" , 'verify stop isn\' t "main" breakpoint'
100
100
)
101
101
102
+ @skipIfWindows
103
+ def test_empty_sourceMap (self ):
104
+ """
105
+ Tests the launch with empty source map should not issue source map command.
106
+ """
107
+ program = self .getBuildArtifact ("a.out" )
108
+ self .build_and_create_debug_adapter ()
109
+ empty_source_map = []
110
+ self .launch (program , sourceMap = empty_source_map )
111
+ self .continue_to_exit ()
112
+
113
+ # Now get the console output and verify no source map command was issued for empty source map.
114
+ console_output = self .get_console ()
115
+ self .assertTrue (
116
+ console_output and len (console_output ) > 0 , "expect some console output"
117
+ )
118
+ self .assertNotIn ("Setting source map:" , console_output )
119
+
102
120
@skipIfWindows
103
121
def test_cwd (self ):
104
122
"""
Original file line number Diff line number Diff line change @@ -57,9 +57,8 @@ void BaseRequestHandler::SetSourceMapFromArguments(
57
57
" source must be be an array of two-element arrays, "
58
58
" each containing a source and replacement path string.\n " ;
59
59
60
- std::string sourceMapCommand;
61
- llvm::raw_string_ostream strm (sourceMapCommand);
62
- strm << " settings set target.source-map " ;
60
+ std::string sourceMapCommandMappings;
61
+ llvm::raw_string_ostream strm (sourceMapCommandMappings);
63
62
const auto sourcePath = GetString (arguments, " sourcePath" ).value_or (" " );
64
63
65
64
// sourceMap is the new, more general form of sourcePath and overrides it.
@@ -94,7 +93,9 @@ void BaseRequestHandler::SetSourceMapFromArguments(
94
93
// Do any source remapping needed before we create our targets
95
94
strm << " \" .\" \" " << sourcePath << " \" " ;
96
95
}
97
- if (!sourceMapCommand.empty ()) {
96
+ if (!sourceMapCommandMappings.empty ()) {
97
+ std::string sourceMapCommand = " settings set target.source-map " ;
98
+ sourceMapCommand += sourceMapCommandMappings;
98
99
dap.RunLLDBCommands (" Setting source map:" , {sourceMapCommand});
99
100
}
100
101
}
You can’t perform that action at this time.
0 commit comments