From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20296 invoked by alias); 21 Jan 2015 20:48:57 -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 20255 invoked by uid 89); 21 Jan 2015 20:48:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mailuogwhop.emc.com Received: from mailuogwhop.emc.com (HELO mailuogwhop.emc.com) (168.159.213.141) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 21 Jan 2015 20:48:48 +0000 Received: from maildlpprd01.lss.emc.com (maildlpprd01.lss.emc.com [10.253.24.33]) by mailuogwprd02.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id t0LKmi3x005336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 21 Jan 2015 15:48:45 -0500 X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd02.lss.emc.com t0LKmi3x005336 X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd02.lss.emc.com t0LKmi3x005336 Received: from mailsyshubprd51.lss.emc.com (mailsyshubprd51.lss.emc.com [10.106.48.26]) by maildlpprd01.lss.emc.com (RSA Interceptor) for ; Wed, 21 Jan 2015 15:47:54 -0500 Received: from usendtaylorx2l.lss.emc.com (usendtaylorx2l.lss.emc.com [10.243.10.188]) by mailsyshubprd51.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id t0LKmSNZ012798 for ; Wed, 21 Jan 2015 15:48:28 -0500 Received: by usendtaylorx2l.lss.emc.com (Postfix, from userid 26043) id E3D365DB781; Wed, 21 Jan 2015 15:48:26 -0500 (EST) Received: from usendtaylorx2l (localhost [127.0.0.1]) by usendtaylorx2l.lss.emc.com (Postfix) with ESMTP id 57E1E5DB77C for ; Wed, 21 Jan 2015 15:48:26 -0500 (EST) From: David Taylor To: gdb@sourceware.org Subject: gdb incremental read missing header files Date: Wed, 21 Jan 2015 20:48:00 -0000 Message-ID: <9190.1421873306@usendtaylorx2l> X-RSA-Classifications: Source Code, DLM_1, public X-Sentrion-Hostname: mailuogwprd02.lss.emc.com X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00042.txt.bz2 When using DWARF debug information, and incremental (the default) reading of debug information, GDB will oftentimes miss header files until the user visits a file that includes, directly or indirectly, the header file. Example (the following is a constructed example; the actual problem is seen when building our embedded kernel that does not include system header files): main.c: ------- extern void print_hello (void); int main (int argc, char *argv[]) { print_hello (); return (0); } hello.c: -------- #include void print_hello (void) { printf ("Hello, world\n"); } build thusly: ------------- gcc -c -g3 -O3 main.c gcc -c -g3 -O3 hello.c gcc -o missing-headers main.o hello.o Run gdb: -------- gdb missing-headers At prompt, type: ---------------- (gdb) info sources Source files for which symbols have been read in: /emc/dtaylor/bugs/missing-headers/main.c Source files for which symbols will be read in on demand: /usr/include/bits/stdio2.h, /emc/dtaylor/bugs/missing-headers/hello.c (gdb) list features.h:1 No source file named features.h. (gdb) list hello.c:1 1 #include 2 3 void 4 print_hello (void) 5 { 6 printf ("Hello, world\n"); 7 } (gdb) info sources Source files for which symbols have been read in: /emc/dtaylor/bugs/missing-headers/hello.c, /usr/include/stdio.h, /usr/include/features.h, /usr/include/bits/predefs.h, /usr/include/sys/cdefs.h, /usr/include/bits/wordsize.h, /usr/include/gnu/stubs.h, /usr/include/gnu/stubs-64.h, /usr/lib/gcc/x86_64-linux-gnu/4.4/include/stddef.h, /usr/include/bits/types.h, /usr/include/bits/typesizes.h, /usr/include/libio.h, /usr/include/_G_config.h, /usr/include/wchar.h, /usr/lib/gcc/x86_64-linux-gnu/4.4/include/stdarg.h, /usr/include/bits/stdio_lim.h, /usr/include/bits/sys_errlist.h, /usr/include/bits/stdio.h, /usr/include/bits/stdio2.h, /emc/dtaylor/bugs/missing-headers/main.c Source files for which symbols will be read in on demand: /usr/include/bits/stdio2.h (gdb) list features.h:1 1 /* Copyright (C) 1991-1993,1995-2007,2009,2010 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of (gdb) I did this with the 7.9 pre-release (to make sure that there wasn't a bug fix that I missed), but the same problem occurs in 7.8 and earlier versions. By contrast, with STABS most (all?) headers are found without the need to first 'visit' a file thst includes them. The above was done on an x86-64 GNU/Linux system, though I doubt that that matters much to duplicating the problem.