Jim, Sorry for missing the information. file evi.c: register void* regVar asm ("r15"); int main() { char *str = "Hello"; regVar = str; return 0; } % gcc -v Using built-in specs. COLLECT_GCC=/tools/oss/packages/x86_64-centos7/gcc/9.3.0/bin/gcc COLLECT_LTO_WRAPPER=/tools/oss/packages/x86_64-rhel7/gcc/9.3.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../../gcc-9.3.0/configure --prefix=/tools/oss/packages/x86_64-centos7/gcc/9.3.0 --with-gnu-as --with-as=/tools/bin/as --with-gnu-ld --with-ld=/tools/bin/ld --with-mpc=/tools/oss/packages/x86_64-centos7/mpc/1.0.3 --with-mpfr=/tools/oss/packages/x86_64-centos7/mpfr/3.1.2 --enable-languages=c,c++,objc --enable-symvers=gnu Thread model: posix gcc version 9.3.0 (GCC) % gcc -g3 evi.c -o evi % gdb evi (gdb) list 1 register void* regVar asm ("r15"); 2 int 3 main() 4 { 5 char *str = "Hello"; 6 regVar = str; 7 return 0; 8 } (gdb) b 7 Breakpoint 1 at 0x400502: file evi.c, line 7. (gdb) r Starting program: evi Breakpoint 1, main () at evi.c:7 7 return 0; (gdb) p regVar Missing ELF symbol "regVar". (gdb) p str $1 = 0x400594 "Hello" (gdb) p/x $r15 $2 = 0x400594 (gdb) p (char *)$r15 $3 = 0x400594 "Hello" I tried it for ARM architecture as well with the same result. Thanks, Yuri On Fri, Aug 13, 2021 at 1:28 PM Jim Wilson <jimw@xxxxxxxxxx> wrote: > On Wed, Aug 11, 2021 at 3:50 PM Yuri Karlsbrun via Gcc-help < > gcc-help@xxxxxxxxxxx> wrote: > >> By default gcc register variables are missing from symbol table, and not >> visible by gdb. Is there a way to save information about register >> variables >> in the object file, and make it visible by gdb? >> > > A small testcase to reproduce would be useful to understand what you are > talking about. Are you using register or asm("register")? Is this a local > or global? What target are you compiling for? What compiler options are > you using? What debug info format are you using? Dwarf, stabs? Why do > you think the debug info is missing? Can you show some gdb output? If you > are using stabs, then that is probably why it is failing for you. Use > dwarf instead. > > JIm > -- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature