diff options
| author | Aymeric Vincent <aymeric.vincent@cea.fr> | 2015-10-27 21:27:27 +0100 |
|---|---|---|
| committer | Aymeric Vincent <aymeric.vincent@cea.fr> | 2015-10-27 21:27:27 +0100 |
| commit | 5dbf046bbe07a28485a84eca14405d271d1ea7fa (patch) | |
| tree | 5cabdd356882f4d2606a02cc0ed468894f68a586 /miasm2/analysis/debugging.py | |
| parent | fb32efb74e2dc1077586a2214de558db6940b70b (diff) | |
| download | miasm-5dbf046bbe07a28485a84eca14405d271d1ea7fa.tar.gz miasm-5dbf046bbe07a28485a84eca14405d271d1ea7fa.zip | |
In interactive use, allow C-like prefixes to choose the base of integers
Use Python's int(s, 0) to allow string "s" to specify its base where addresses and offsets can be supplied. This change makes the situation homogeneous among the various examples and interactive usage.
Diffstat (limited to 'miasm2/analysis/debugging.py')
| -rw-r--r-- | miasm2/analysis/debugging.py | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/miasm2/analysis/debugging.py b/miasm2/analysis/debugging.py index 3fffbf66..74551a72 100644 --- a/miasm2/analysis/debugging.py +++ b/miasm2/analysis/debugging.py @@ -273,10 +273,7 @@ class DebugCmd(cmd.Cmd, object): def add_breakpoints(self, bp_addr): for addr in bp_addr: - if "0x" in addr: - addr = int(addr, 16) - else: - addr = int(addr) + addr = int(addr, 0) good = True for i, dbg_obj in enumerate(self.dbg.bp_list): @@ -359,17 +356,11 @@ class DebugCmd(cmd.Cmd, object): args = arg.split(" ") if len(args) >= 2: - if "0x" in args[1]: - size = int(args[1], 16) - else: - size = int(args[1]) + size = int(args[1], 0) else: size = 0xF - if "0x" in args[0]: - addr = int(args[0], 16) - else: - addr = int(args[0]) + addr = int(args[0], 0) self.dbg.watch_mem(addr, size) @@ -445,16 +436,10 @@ class DebugCmd(cmd.Cmd, object): else: args = arg.split(" ") if len(args) >= 2: - if "0x" in args[1]: - size = int(args[1], 16) - else: - size = int(args[1]) + size = int(args[1], 0) else: size = 0xF - if "0x" in args[0]: - addr = int(args[0], 16) - else: - addr = int(args[0]) + addr = int(args[0], 0) self.dbg.get_mem(addr, size) |