File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,7 @@ class ContextType(object):
359
359
'encoding' : 'auto' ,
360
360
'endian' : 'little' ,
361
361
'gdbinit' : "" ,
362
+ 'gdb_binary' : "" ,
362
363
'kernel' : None ,
363
364
'local_libcdb' : "/var/lib/libc-database" ,
364
365
'log_level' : logging .INFO ,
@@ -1539,6 +1540,20 @@ def gdbinit(self, value):
1539
1540
"""
1540
1541
return str (value )
1541
1542
1543
+ @_validator
1544
+ def gdb_binary (self , value ):
1545
+ """Path to the binary that is used when running GDB locally.
1546
+
1547
+ This is useful when you have multiple versions of gdb installed or the gdb binary is
1548
+ called something different.
1549
+
1550
+ If set to an empty string, pwntools will try to search for a reasonable gdb binary from
1551
+ the path.
1552
+
1553
+ Default value is ``""``.
1554
+ """
1555
+ return str (value )
1556
+
1542
1557
@_validator
1543
1558
def cyclic_alphabet (self , alphabet ):
1544
1559
"""Cyclic alphabet.
Original file line number Diff line number Diff line change @@ -750,7 +750,10 @@ def binary():
750
750
>>> gdb.binary() # doctest: +SKIP
751
751
'/usr/bin/gdb'
752
752
"""
753
- gdb = misc .which ('pwntools-gdb' ) or misc .which ('gdb' )
753
+ if context .gdb_binary :
754
+ gdb = misc .which (context .gdb_binary )
755
+ else :
756
+ gdb = misc .which ('pwntools-gdb' ) or misc .which ('gdb' )
754
757
755
758
if not context .native :
756
759
multiarch = misc .which ('gdb-multiarch' )
You can’t perform that action at this time.
0 commit comments