From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32591 invoked by alias); 20 Mar 2015 08:11:24 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 32577 invoked by uid 89); 20 Mar 2015 08:11:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ie0-f174.google.com Received: from mail-ie0-f174.google.com (HELO mail-ie0-f174.google.com) (209.85.223.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 20 Mar 2015 08:11:23 +0000 Received: by iecvj10 with SMTP id vj10so87078192iec.0 for ; Fri, 20 Mar 2015 01:11:20 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.42.93.83 with SMTP id w19mr2275575icm.37.1426839080827; Fri, 20 Mar 2015 01:11:20 -0700 (PDT) Received: by 10.36.115.204 with HTTP; Fri, 20 Mar 2015 01:11:20 -0700 (PDT) In-Reply-To: <83a8z8w13l.fsf@gnu.org> References: <83a8z8w13l.fsf@gnu.org> Date: Fri, 20 Mar 2015 08:11:00 -0000 Message-ID: Subject: Re: No source file named getopt.c. From: Fei Ding To: Eli Zaretskii Cc: "gdb@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00075.txt.bz2 I am debugging gdb using gdb, I want to know how gdb handle the command "gdb filename options", and I've traced to the code of gdb/main.c, which is main.c:captured_main(), and I lost myself when step into getopt_long_only() near line 520 (gdb-7.6) 2015-03-20 15:59 GMT+08:00 Eli Zaretskii : >> Date: Fri, 20 Mar 2015 14:09:00 +0800 >> From: Fei Ding >> >> 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.