From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2012 invoked by alias); 23 Jan 2008 18:04:55 -0000 Received: (qmail 1998 invoked by uid 22791); 23 Jan 2008 18:04:54 -0000 X-Spam-Check-By: sourceware.org Received: from ns2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 23 Jan 2008 18:04:31 +0000 Received: from Relay2.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id E5A763012B for ; Wed, 23 Jan 2008 19:04:28 +0100 (CET) Date: Wed, 23 Jan 2008 18:04:00 -0000 From: Olaf Hering To: gdb@sourceware.org Subject: Re: gdb follows symlinks when looking for debuginfo Message-ID: <20080123180428.GA26139@suse.de> References: <20080123161537.GA25123@suse.de> <20080123173137.GA15119@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20080123173137.GA15119@caradoc.them.org> X-DOS: I got your 640K Real Mode Right Here Buddy! X-Homeland-Security: You are not supposed to read this line! You are a terrorist! User-Agent: Mutt und vi sind doch schneller als Notes (und GroupWise) 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 X-SW-Source: 2008-01/txt/msg00234.txt.bz2 On Wed, Jan 23, Daniel Jacobowitz wrote: > On Wed, Jan 23, 2008 at 05:15:37PM +0100, Olaf Hering wrote: > > > > Why does gdb follow symlinks when looking for debuginfo and executables? > > Most likely something uses realpath when opening files. Looks like > exec_file_attach -> openp -> xfullpath. > > > The binaries in our installation images are symlinked into a > > loop-mounted cramfs image, or to an extracted tree on a remote > > filesystem. > > The gdb binary itself is a symlink /usr/bin/gdb -> > > /mounts/inst-sys/usr/bin/gdb. For some reason, gdb starts to look for > > debuginfo in /mounts/inst-sys/usr/lib/debug instead of just > > /usr/lib/debug. The same is true for the executable thats being > > debugged. > > That path is surprising. I would have expected > /usr/lib/debug/mounts/inst-sys/... Does "show sysroot" > show anything? What about "show debug-file-directory"? The current system root is "". The directory where separate debug symbols are searched for is "/mounts/instsys/usr/lib/debug". You are right. I should have pasted the correct path into the mail. For 3 yast libs (the first 3 libs to load), the path is wrong. inst-sys:/ # grep y2wfm.so /X 2953 open("/usr/lib/YaST2/plugin/libpy2wfm.so.2", O_RDONLY) = 7 2953 stat64("/usr/lib/YaST2/plugin/libpy2wfm.so.2", {st_mode=S_IFREG|0755, st_size=121048, ...}) = 0 2953 open("/usr/lib/YaST2/plugin/libpy2wfm.so.2", O_RDONLY) = 7 2953 open("/mounts/instsys/usr/lib/YaST2/plugin/libpy2wfm.so.2.0.0.debug", O_RDONLY) = -1 ENOENT (No such file or directory) 2953 open("/mounts/instsys/usr/lib/YaST2/plugin/.debug/libpy2wfm.so.2.0.0.debug", O_RDONLY) = -1 ENOENT (No such file or directory) 2953 open("/mounts/instsys/usr/lib/debug//mounts/instsys/usr/lib/YaST2/plugin/libpy2wfm.so.2.0.0.debug", O_RDONLY) = -1 ENOENT (No such file or directory) 2953 open("/mounts/instsys/usr/lib/debug/mounts/instsys/usr/lib/YaST2/plugin/libpy2wfm.so.2.0.0.debug", O_RDONLY) = -1 ENOENT (No such file or directory) Should have been /mounts/instsys/usr/lib/debug/usr/lib/YaST2/plugin/libpy2wfm.so.2.0.0.debug Maybe wrong debuginfo generated by gcc? They are not dlopen objects. For all others the debuginfo can be loaded. inst-sys:/ # grep libexpat.so.1 /X 2953 open("/lib/libexpat.so.1", O_RDONLY) = 3 2953 open("/lib/libexpat.so.1", O_RDONLY) = 13 2953 stat64("/lib/libexpat.so.1", {st_mode=S_IFREG|0755, st_size=193996, ...}) = 0 2953 open("/lib/libexpat.so.1", O_RDONLY) = 5 2953 open("/lib/libexpat.so.1.5.2.debug", O_RDONLY) = -1 ENOENT (No such file or directory) 2953 open("/lib/.debug/libexpat.so.1.5.2.debug", O_RDONLY) = -1 ENOENT (No such file or directory) 2953 open("/mounts/instsys/usr/lib/debug//lib/libexpat.so.1.5.2.debug", O_RDONLY) = 6 2953 stat64("/mounts/instsys/usr/lib/debug//lib/libexpat.so.1.5.2.debug", {st_mode=S_IFREG|0644, st_size=289219, ...}) = 0 2953 open("/mounts/instsys/usr/lib/debug//lib/libexpat.so.1.5.2.debug", O_RDONLY) = 6 The gdb output is: ............... Reading symbols from /mounts/instsys/usr/lib/YaST2/plugin/libpy2wfm.so.2...expanding to full symbols...(no debugging symbols found)...done. Loaded symbols for /usr/lib/YaST2/plugin/libpy2wfm.so.2 Reading symbols from /mounts/instsys/usr/lib/YaST2/plugin/libpy2scr.so.2...expanding to full symbols...(no debugging symbols found)...done. Loaded symbols for /usr/lib/YaST2/plugin/libpy2scr.so.2 Reading symbols from /mounts/instsys/usr/lib/YaST2/plugin/libpy2UI.so.2...expanding to full symbols...(no debugging symbols found)...done. Loaded symbols for /usr/lib/YaST2/plugin/libpy2UI.so.2 Reading symbols from /usr/lib/libscr.so.2...expanding to full symbols...Reading symbols from /mounts/instsys/usr/lib/debug/usr/lib/libscr.so.2.0.0.debug...expanding to full symbols...done. done. .............. Why are the first 3 libs searched in /mounts/instsys instead of /?