GDB oddness.

So I’m debugging a program in gdb. This program ships with a copy of GNU getopt so that getopt_long() is available to it everywhere. When debugging this program, however, the value of optarg is always printed out as NULL, even though when it is passed as a function the true value is displayed. I’m thinking that maybe gdb is seeing the the optarg variable in my local copy of getopt rather than the libc one that is getting used in my development environment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: