MCPcopy
hub / github.com/Gallopsled/pwntools / binary

Function binary

pwnlib/gdb.py:738–769  ·  view source on GitHub ↗

binary() -> str Returns: str: Path to the appropriate ``gdb`` binary to use. Example: >>> gdb.binary() # doctest: +SKIP '/usr/bin/gdb'

()

Source from the content-addressed store, hash-verified

736 }.get(context.arch, context.arch)
737
738def binary():
739 """binary() -> str
740
741 Returns:
742 str: Path to the appropriate ``gdb`` binary to use.
743
744 Example:
745
746 >>> gdb.binary() # doctest: +SKIP
747 '/usr/bin/gdb'
748 """
749 if context.gdb_binary:
750 gdb = misc.which(context.gdb_binary)
751 if not gdb:
752 log.warn_once('Path to gdb binary `{}` not found'.format(context.gdb_binary))
753 return gdb
754
755 gdb = misc.which('pwntools-gdb') or misc.which('gdb')
756
757 if not context.native:
758 multiarch = misc.which('gdb-multiarch')
759
760 if multiarch:
761 return multiarch
762 log.warn_once('Cross-architecture debugging usually requires gdb-multiarch\n'
763 '$ apt-get install gdb-multiarch')
764
765 if not gdb:
766 log.error('GDB is not installed\n'
767 '$ apt-get install gdb')
768
769 return gdb
770
771class Breakpoint:
772 """Mirror of ``gdb.Breakpoint`` class.

Callers 2

attachFunction · 0.70
corefileFunction · 0.70

Calls 4

whichMethod · 0.80
warn_onceMethod · 0.80
formatMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected