'In GDB, how to print the content of a symbol which has special characters?

I encounter a small problem when debugging with GDB. The problem is like this:

When I want to get the address of 'main', I can do

gdb-peda$ p main
$1 = {<text variable, no debug info>} 0x400b21 <main>
gdb-peda$ x main
0x400b21 <main>:        0x000000b8e5894855

But if I want to get the address of '[email protected]', it becomes

gdb-peda$ x [email protected]
No symbol table is loaded.  Use the "file" command.
gdb-peda$ p [email protected]
No symbol table is loaded.  Use the "file" command.

And '[email protected]' actually exists.

gdb-peda$ x 0x602020
0x602020 <[email protected]>:        0x00000000004006e6

I think I have to escape '@' and '.' such that the information of '[email protected]' can be printed out successfully, but I don't know how to do. Can anyone help me?

------ 2020/05/03 edited ------

Thank @JohnKoch, I tried x &'[email protected]', it works.

Although I can't figure out why it does not just print the content of '[email protected]' when using x '[email protected]', such that I need to add &......

gdb-peda$ x/4gx '[email protected]'
0x7ffff7a649c0 <_IO_puts>:      0x55fc894954415541      0x072ee808ec834853
0x7ffff7a649d0 <_IO_puts+16>:   0x36be6f2d8b48fffa      0x4800458bc3894800

Add &:

gdb-peda$ x/4gx &'[email protected]'
0x602020 <[email protected]>:        0x00007ffff7a649c0      0x00000000004006f6
0x602030 <[email protected]>:      0x0000000000400706      0x0000000000400716
gdb


Solution 1:[1]

Use single quotes like this:

(gdb) p 'my weird symbol'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 andrewrk