File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1- -Wipe source code dirs when attaching/loading file (otherwise unpredictable vuln.c)
2-
31Test:
42 -Shell spawn / multiple threads
53 -Docker setup + attach
Original file line number Diff line number Diff line change @@ -227,6 +227,9 @@ def select_file(self):
227227 # Before loading the file we want to set the correct tty for the inferior
228228 self .set_gdb_tty .emit (self .inferior_handler .tty )
229229 self .set_gdb_file_target_signal .emit ([file_name ])
230+ # Reset dir so that GDB doesn't get confused when we load multiple programs with the same name / source
231+ # file name
232+ self .set_gdb_source_dir_signal .emit (["" ])
230233 # GDB only looks for source files in the cwd, so we additionally add the directory of the executable
231234 self .set_gdb_source_dir_signal .emit ([str (Path (file_name ).parent )])
232235 self .main_context .inferior_attached = False
@@ -341,6 +344,9 @@ def attach_to_pid(self, pid: int):
341344 Attach to the given (valid) PID. Also sets the search directories and updates the contexts after attaching
342345 :param pid: The PID of a running program
343346 """
347+ # Reset dir so that GDB doesn't get confused when we load multiple programs with the same name / source
348+ # file name
349+ self .set_gdb_source_dir_signal .emit (["" ])
344350 # Add the directory of the executable as a search directory for source files for GDB
345351 process_path = Path (psutil .Process (pid ).exe ()).parent .resolve ()
346352 self .set_gdb_source_dir_signal .emit ([str (process_path )])
You can’t perform that action at this time.
0 commit comments