为什么在访问$EAX时,“值不能转换为整数”?

时间:2022-10-24 21:04:52

Why cant I access any information of %eax? Here is a screenshot. I'm pretty sure %eax is holding a string of some sort...

为什么我不能访问%eax的信息?这是一个屏幕截图。我很确定%eax持有某种字符串…

为什么在访问$EAX时,“值不能转换为整数”?

Ok here is the function im debugging. It takes 6 numbers and if one is wrong there is a "bomb" that blows up. Here is the function:

这是我调试的函数。它需要6个数字,如果一个是错误的,就会有一个“炸弹”爆炸。这是功能:

40106b: 55                      push   %rbp
40106c: 53                      push   %rbx
40106d: 48 83 ec 28             sub    $0x28,%rsp
401071: 48 89 e6                mov    %rsp,%rsi
401074: e8 ae 03 00 00          callq  401427 <read_six_numbers>
401079: 83 3c 24 01             cmpl   $0x1,(%rsp)
40107d: 74 05                   je     401084 <phase_2+0x19>
40107f: e8 6d 03 00 00          callq  4013f1 <explode_bomb>
401084: 48 8d 5c 24 04          lea    0x4(%rsp),%rbx
401089: 48 8d 6c 24 18          lea    0x18(%rsp),%rbp
40108e: 8b 43 fc                mov    0xfffffffffffffffc(%rbx),%eax
401091: 01 c0                   add    %eax,%eax
401093: 39 03                   cmp    %eax,(%rbx)
401095: 74 05                   je     40109c <phase_2+0x31>
401097: e8 55 03 00 00          callq  4013f1 <explode_bomb>
40109c: 48 83 c3 04             add    $0x4,%rbx
4010a0: 48 39 eb                cmp    %rbp,%rbx
4010a3: 75 e9                   jne    40108e <phase_2+0x23>
4010a5: 48 83 c4 28             add    $0x28,%rsp
4010a9: 5b                      pop    %rbx
4010aa: 5d                      pop    %rbp
4010ab: c3                      retq   

and this is read_six_numbers if needed:

如果需要,这是read_six_numbers:

0000000000401427 <read_six_numbers>:
401427: 48 83 ec 18             sub    $0x18,%rsp
40142b: 48 8d 4e 04             lea    0x4(%rsi),%rcx
40142f: 48 8d 46 14             lea    0x14(%rsi),%rax
401433: 48 89 44 24 08          mov    %rax,0x8(%rsp)
401438: 48 8d 46 10             lea    0x10(%rsi),%rax
40143c: 48 89 04 24             mov    %rax,(%rsp)
401440: 4c 8d 4e 0c             lea    0xc(%rsi),%r9
401444: 4c 8d 46 08             lea    0x8(%rsi),%r8
401448: 48 89 f2                mov    %rsi,%rdx
40144b: be 7e 26 40 00          mov    $0x40267e,%esi
401450: b8 00 00 00 00          mov    $0x0,%eax
401455: e8 26 f7 ff ff          callq  400b80 <sscanf@plt>
40145a: 83 f8 05                cmp    $0x5,%eax
40145d: 7f 05                   jg     401464 <read_six_numbers+0x3d>
40145f: e8 8d ff ff ff          callq  4013f1 <explode_bomb>
401464: 48 83 c4 18             add    $0x18,%rsp
401468: c3                      retq   

1 个解决方案

#1


3  

Try x/w $rax instead. GDB doesn't know what $eax is when debugging 64-bit code.

试试x / w美元伸展。在调试64位代码时,GDB不知道eax是什么。

This could be considered a bug(let) in GDB.

这可以被认为是GDB中的一个bug(let)。

#1


3  

Try x/w $rax instead. GDB doesn't know what $eax is when debugging 64-bit code.

试试x / w美元伸展。在调试64位代码时,GDB不知道eax是什么。

This could be considered a bug(let) in GDB.

这可以被认为是GDB中的一个bug(let)。