2

I have not yet found the solution on internet so i ask it here. Never had this problem before it was always doing fine, so i don't know what changed. I'm using gdb peda but the problem stays the same with normal gdb.

I'm loading a program called "main" in gdb : gdb main

Then I get the functions name : info functions

0x000000000000162f  main

(I removed extra symbols, it actually shows more symbols)

Then I disassamble the main : disas main

0x0000000000001708 <+217>:   movzx  eax,BYTE PTR [rbp+rax*1-0x70]
0x000000000000170d <+222>:   cmp    dl,al
0x000000000000170f <+224>:   je     0x1718 <main+233>

(Same here I only show a small part) Since I'm interested in watching what is being compared I want to set a breakpoint there b *0x170d

And when I run it it says

Cannot insert breakpoint 1.
Cannot access memory at address 0x170d

So I tried to set up a breakpoint at address 0x0 but I get the same error.

Running it first and then disassembling it gives the following :

0x0000555555555708 <+217>:   movzx  eax,BYTE PTR [rbp+rax*1-0x70]
0x000055555555570d <+222>:   cmp    dl,al
0x000055555555570f <+224>:   je     0x555555555718 <main+233>

On another computer it's working fine I just set the breakpoint at the address it shows. I usually use ghidra and set the breakpoint at the addresses shown in ghidra's disassembler. I read that it was a problem with gdb not mapping memory but i have not found a working solution.

to kind of resolve it what I'm doing is that I run it first then read memory when it's running I take the address of the instruction where I want to set the breakpoint and rerun it.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.