GDB Patching results in "Unable to access memory at address 0x

I have a program that I need to install using GDB. The problem is that there is a line of code that makes the “test smaller or equal” and prevents the program from completing the operation with a segmentation error. The program has already been compiled, and I do not have a source, so I can not change the source code. However, using GDB, I was able to find where <= test was executed, and then I was able to find the memory address, which you can see below.

    (gdb) x/100i $pc
    ... removed extra lines ...
    0x7ffff7acb377:      jle    0x7ffff7acb3b1
    ....

All I have to do is change the test to a test of "greater than or equal to", and then the program should work fine. The operation code for jle is 0x7e, and I need to change it to 0x7d. My assignment provides instructions on how to do this as follows:

    $ gdb -write -q programtomodify
    (gdb) set {unsigned char} 0x8040856f = 0x7d
    (gdb) quit

, ...

    $ gdb -write -q player
    (gdb) set {unsigned char} 0x7ffff7acb377 = 0x7d
    Cannot access memory at address 0x7ffff7acb377

, , , . , , , .

Linux Mint 14 VMware Player

+5
1

Cannot access memory at address 0x7ffff7acb377

, - . , info sym 0x7ffff7acb377.

, , , .

main. . , "stick".

+2

All Articles