This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: No source file named getopt.c.
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Fei Ding <fdingiit at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Fri, 20 Mar 2015 09:59:42 +0200
- Subject: Re: No source file named getopt.c.
- Authentication-results: sourceware.org; auth=none
- References: <CAGmPkf+mTt7xhZmWkR4oN-9h6jki1MUh8Rn0G06YhS4pQ8=H1A at mail dot gmail dot com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Fri, 20 Mar 2015 14:09:00 +0800
> From: Fei Ding <fdingiit@gmail.com>
>
> I want to set a break point on some code in getopt.c, but I just got:
>
> ////////////////////////////////////////////
> (gdb) b getopt.c:100
> No source file named getopt.c.
> ////////////////////////////////////////////
>
> then, I did this to add the source directory of that code, as:
>
> ////////////////////////////////////////////
> (gdb) directory /home/dingaaa/test/gdb-7.6/libiberty/
> Source directories searched: /home/dingaaa/test/gdb-7.6/libiberty:$cdir:$cwd
> ////////////////////////////////////////////
>
> but still, I get
> ////////////////////////////////////////////
> (gdb) b getopt.c:100
> No source file named getopt.c.
> ////////////////////////////////////////////
>
> BTW: I've changed Makefiles, with `-g -O0`
>
> What's the problem?
You can only do this when debugging a program that has getopt.c
compiled in. Since you give no details on how you built that program,
it's hard to say something more intelligent.