Bug 157037 - gdb fails to retrieve "optarg" correctly
Summary: gdb fails to retrieve "optarg" correctly
Status: RESOLVED INVALID
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Development (show other bugs)
Version: Beta 7
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Andreas Schwab
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-10 13:21 UTC by Marcus Meissner
Modified: 2006-03-14 13:59 UTC (History)
1 user (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
xx.c (68 bytes, text/plain)
2006-03-10 13:29 UTC, Marcus Meissner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Meissner 2006-03-10 13:21:46 UTC
gdb cannot show the content if "optarg", a global glibc variable, correctly.

The following sample program shows this behaviour:

(gdb) break main
Breakpoint 1 at 0x4004ec: file xx.c, line 4.
(gdb) r
Starting program: /suse/meissner/xx

Breakpoint 1, main () at xx.c:4
4               return optarg;
(gdb) disp /i $eip
Disabling display 1 to avoid infinite recursion.
1: x/i $eip  Value can't be converted to integer.
(gdb) disp /i $rip
2: x/i $rip  0x4004ec <main+4>:
    mov    1049517(%rip),%rax        # 0x5008a0 <optarg@@GLIBC_2.2.5>
(gdb) si
5       }
2: x/i $rip  0x4004f3 <main+11>:        leaveq
(gdb) print optarg
$1 = 0x0
(gdb) print &optarg
$2 = (char **) 0x2ae8237f9cc0
(gdb)

print &optarg should have shown 0x5008a0.
Comment 1 Marcus Meissner 2006-03-10 13:29:05 UTC
Created attachment 72258 [details]
xx.c
Comment 2 Andreas Schwab 2006-03-13 12:24:21 UTC
gdb is just reporting what the debug info delivers.  The symbol you want is called 'optarg@@GLIBC_2.2.5'.
Comment 3 Christian Zoz 2006-03-14 13:59:37 UTC
What i want is that gdb shows me the right content of my variables.

Do i understand that correctly that i had to type 'print optarg@@GLIBC_2.2.5' to see the value of what is called 'optarg' in my sources?

Where in the docs can i read about that?