opened
u0m3
username_0
### Step 1: Describe your environment

  * Operating System: Linux - 4.9.0-5-arm64 (64bit) on debian 9.3
  * Architecture: Arm64/AARCH64
  * GDB version (including the Python library version): **GDB** 7.12.0.20161007-git (**Python** 3.5.3 - final)


### Step 2: Describe your problem
gef fails to parse the sencond operand (`#imm` in ARM docs; operand[1] in gef code) because it's prefixed with a pound sign (`#`)

#### Steps to reproduce

  1. Debug any aarch64 binary with a _**TBZ**_ or _**TBNZ**_ instruction
  1. Reach said instruction
  1. Observe gef freak out

#### Observed Results
Instead of expected assembler display with contextual hints (in this case, branch followed/not followed hint), gef outputs an error message
```
[!] Command 'context' failed to execute properly, reason: invalid literal for int() with base 10: ' #31'
```

#### Expected results
Normal gef operation

#### Traces
Output with `gef config gef.debug 1`
```
─────────────────────────────── Exception raised ───────────────────────────────
ValueError: invalid literal for int() with base 10: ' #31'
───────────────────────────── Detailed stacktrace ──────────────────────────────
↳ File "/home/radu/gef/gef.py", line 1487, in is_branch_taken()
    →     i = int(operands[1])
↳ File "/home/radu/gef/gef.py", line 6535, in context_code()
    →     is_taken, reason = current_arch.is_branch_taken(insn)
↳ File "/home/radu/gef/gef.py", line 6395, in do_invoke()
    →     layout_mapping[section]()
↳ File "/home/radu/gef/gef.py", line 1994, in wrapper()
    →     return f(*args, **kwargs)
↳ File "/home/radu/gef/gef.py", line 3339, in invoke()
    →     self.do_invoke(argv)
───────────────────────────── Last 10 GDB commands ─────────────────────────────
  250  b *0x000000000049bd5c
  251  gef config context.clear_screen 1
  252  r
  253  context
  254  gef config gef.debug 1
  255  context
  256  q
  257  gef config gef.debug 1
  258  b *0x000000000049bd5c
  259  r
───────────────────────────── Runtime environment ──────────────────────────────
* GDB: 7.12.0.20161007-git
* Python: 3.5.3 - final
* OS: Linux - 4.9.0-5-arm64 (64bit) on debian 9.3
────────────────────────────────────────────────────────────────────────────────
```
Failure to parse TBZ/TBNZ instruction #imm value for aarch64
issue
closed
hugsy
username_1
issue
created
hugsy
username_1
Fixed by #213
comment