File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed
packages/Python/lldbsuite/test/tools/lldb-dap
test/API/tools/lldb-dap/launch Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -851,7 +851,7 @@ def request_launch(
851851 args_dict ["debuggerRoot" ] = debuggerRoot
852852 if launchCommands :
853853 args_dict ["launchCommands" ] = launchCommands
854- if sourceMap :
854+ if sourceMap is not None : # sourceMap can be empty array.
855855 args_dict ["sourceMap" ] = sourceMap
856856 if runInTerminal :
857857 args_dict ["runInTerminal" ] = runInTerminal
Original file line number Diff line number Diff line change @@ -99,6 +99,24 @@ def test_stopOnEntry(self):
9999 reason , "breakpoint" , 'verify stop isn\' t "main" breakpoint'
100100 )
101101
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+
102120 @skipIfWindows
103121 def test_cwd (self ):
104122 """
Original file line number Diff line number Diff line change @@ -57,9 +57,8 @@ void BaseRequestHandler::SetSourceMapFromArguments(
5757 " source must be be an array of two-element arrays, "
5858 " each containing a source and replacement path string.\n " ;
5959
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);
6362 const auto sourcePath = GetString (arguments, " sourcePath" ).value_or (" " );
6463
6564 // sourceMap is the new, more general form of sourcePath and overrides it.
@@ -94,7 +93,9 @@ void BaseRequestHandler::SetSourceMapFromArguments(
9493 // Do any source remapping needed before we create our targets
9594 strm << " \" .\" \" " << sourcePath << " \" " ;
9695 }
97- if (!sourceMapCommand.empty ()) {
96+ if (!sourceMapCommandMappings.empty ()) {
97+ std::string sourceMapCommand = " settings set target.source-map " ;
98+ sourceMapCommand += sourceMapCommandMappings;
9899 dap.RunLLDBCommands (" Setting source map:" , {sourceMapCommand});
99100 }
100101}
You can’t perform that action at this time.
0 commit comments