binary() -> str Returns: str: Path to the appropriate ``gdb`` binary to use. Example: >>> gdb.binary() # doctest: +SKIP '/usr/bin/gdb'
()
| 736 | }.get(context.arch, context.arch) |
| 737 | |
| 738 | def 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 | |
| 771 | class Breakpoint: |
| 772 | """Mirror of ``gdb.Breakpoint`` class. |