Skip to content

Commit fe657e6

Browse files
committed
only pass args when they are present
1 parent 2cc3856 commit fe657e6

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

gdbgui/statemanager.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ def __init__(self, config: Dict[str, Any]):
1717
self.gdb_reader_thread = None
1818
self.config = config
1919

20+
def get_gdb_args(self):
21+
gdb_args = REQUIRED_GDB_FLAGS
22+
if self.config["gdb_args"]:
23+
gdb_args += self.config["gdb_args"]
24+
25+
if self.config["initial_binary_and_args"]:
26+
gdb_args += ["--args"]
27+
gdb_args += self.config["initial_binary_and_args"]
28+
return gdb_args
29+
2030
def connect_client(self, client_id: str, desired_gdbpid: int) -> Dict[str, Any]:
2131
message = ""
2232
pid: Optional[int] = 0
@@ -44,12 +54,7 @@ def connect_client(self, client_id: str, desired_gdbpid: int) -> Dict[str, Any]:
4454
if self.get_controller_from_client_id(client_id) is None:
4555
logger.info("new sid", client_id)
4656

47-
gdb_args = (
48-
REQUIRED_GDB_FLAGS
49-
+ self.config["gdb_args"]
50-
+ ["--args"]
51-
+ self.config["initial_binary_and_args"]
52-
)
57+
gdb_args = self.get_gdb_args()
5358

5459
controller = GdbController(
5560
gdb_path=self.config["gdb_path"],

0 commit comments

Comments
 (0)