1

I'm trying to call a library function to test something while debugging with GDB. (dlinfo())

It takes a reference to an int and the function writes the result to that address.

I tried calling malloc so I could pass a reference into the function, but when I try and see if malloc worked, I can never access the memory.

(gdb) p (int *) malloc(sizeof(int)) 
$8 = (int *) 0xffffffffa9e83f28
(gdb) p * (int *)0xffffffffa9e83f28 = 5                     
Cannot access memory at address 0xffffffffa9e83f28

Am I doing something wrong?

Thanks in advance

user2837329
  • 73
  • 1
  • 11

0 Answers0