So here is the source code of the binary:
#include <stdio.h>
int main(){
printf("Hello World\n");
return 0;
}
and below is the compilation of this source code:
@CTOS:/tmp/mytemp$ gcc helloWorld.c -o helloWorld
Now when I disassemble my binary in gdb as below:
Reading symbols from helloWorld...
(No debugging symbols found in helloWorld)
(gdb) disassemble main
Dump of assembler code for function main:
0x0000000000001149 <+0>: endbr64
0x000000000000114d <+4>: push %rbp
0x000000000000114e <+5>: mov %rsp,%rbp
0x0000000000001151 <+8>: lea 0xeac(%rip),%rax
0x0000000000001158 <+15>: mov %rax,%rdi
0x000000000000115b <+18>: call 0x1050 <puts@plt>
0x0000000000001160 <+23>: mov $0x0,%eax
0x0000000000001165 <+28>: pop %rbp
0x0000000000001166 <+29>: ret
End of assembler dump.
(gdb) p (char*)0xeac
$1 = 0xeac <error: Cannot access memory at address 0xeac>
Now I want to know the address of the "Hello World" string which is passed inside puts function call, I want to display the address in gdb by gdb command. How do I do that?