From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10842 invoked by alias); 7 Jan 2007 07:14:00 -0000 Received: (qmail 10834 invoked by uid 22791); 7 Jan 2007 07:13:59 -0000 X-Spam-Check-By: sourceware.org Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 07 Jan 2007 07:13:54 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id C2B6548CBF8 for ; Sun, 7 Jan 2007 02:13:52 -0500 (EST) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06889-01-3 for ; Sun, 7 Jan 2007 02:13:52 -0500 (EST) Received: from takamaka.act-europe.fr (AStDenis-105-1-33-164.w80-8.abo.wanadoo.fr [80.8.163.164]) by nile.gnat.com (Postfix) with ESMTP id 8120348CBF4 for ; Sun, 7 Jan 2007 02:13:50 -0500 (EST) Received: by takamaka.act-europe.fr (Postfix, from userid 1000) id 114CB34C099; Sun, 7 Jan 2007 11:14:39 +0400 (RET) Date: Sun, 07 Jan 2007 07:14:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [RFA/ada] Improve is_known_support_routine Message-ID: <20070107071439.GA537@adacore.com> References: <20070106182652.GR15512@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline In-Reply-To: <20070106182652.GR15512@adacore.com> User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-01/txt/msg00208.txt.bz2 --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 2922 I noticed while cleaning up the same code that I forgot to delete a local variable that became unused. Here is a new patch. Rested on x86-linux. > A customer just reported us an issue that we never noticed before. > It can be reduced to this: > > procedure Foo is > begin > raise Constraint_Error; > end Foo; > > We're setting an exception catchpoint. Then we debug from a location > that's not where the sources are ("cd subdir"): > > % gnatmake -g foo > % gdb foo > (gdb) cd subdir > (gdb) catch exception > (gdb) run > Catchpoint 1, CONSTRAINT_ERROR at <__gnat_raise_nodefer_with_msg> > (e=0x805844c) at a-except.adb:818 > 818 a-except.adb: No such file or directory. > in a-except.adb > (gdb) f > #0 <__gnat_raise_nodefer_with_msg> (e=0x805844c) at a-except.adb:818 > 818 in a-except.adb > > As you see, the debugger did not go up the call stack to foo.adb. > Here is the the expected output: > > (gdb) run > Catchpoint 1, CONSTRAINT_ERROR at 0x080497fe in foo () at foo.adb:3 > 3 raise Constraint_Error; > (gdb) f > #4 0x080497fe in foo () at foo.adb:3 > 3 raise Constraint_Error; > > The is_known_support_routine identifies any frame for which we cannot > find the source file. The check we currently have in place is a bit too > simplistic, so I replaced it with the function we use to locate source > files: > > - if (stat (sal.symtab->filename, &st)) > + if (symtab_to_fullname (sal.symtab) == NULL) > > Unfortunately, I cannot reproduce this within our testsuite, because > we use GNAT project files to build the executable. One of the side effects > of using a project file is that the compiler is called with the absolute > filename rather than a relative filename. As a result, symtab->filename > contains the absolute path, and hence the stat call always succeeds. > > Because we offer the option of building GDB out of tree, apart from > creating on the fly the setup in a temporary directory, followed by > compiling and then testing there, I am not sure how to create a testcase > for this issue... We were able to add a testcase in our testsuite, > however, as it uses another type of technology that allows us to build > our example programs without project files. > > For now, I propose that we commit this patch without adding a testcase. > I think that the symtab_to_fullname routine is already fairly > extensively tested as it just a wrapper around a fairly central routine > in source location. > > 2007-01-06 Joel Brobecker > > * ada-lang.c: Add include of source.h. > (is_known_support_routine): Improve the check verifying that the file > associated to this frame exists. > * Makefile.in (ada-lang.o): Add dependency on source.h. > > Tested on x86-linux. Ok to apply? Thank you, -- Joel --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="stat.diff" Content-length: 1938 Index: ada-lang.c =================================================================== RCS file: /cvs/src/src/gdb/ada-lang.c,v retrieving revision 1.88 diff -u -p -r1.88 ada-lang.c --- ada-lang.c 4 Jan 2007 06:31:51 -0000 1.88 +++ ada-lang.c 7 Jan 2007 07:11:44 -0000 @@ -55,6 +55,7 @@ Boston, MA 02110-1301, USA. */ #include "exceptions.h" #include "annotate.h" #include "valprint.h" +#include "source.h" #ifndef ADA_RETAIN_DOTS #define ADA_RETAIN_DOTS 0 @@ -9056,7 +9057,6 @@ is_known_support_routine (struct frame_i = find_pc_line (get_frame_pc (frame), pc_is_after_call); char *func_name; int i; - struct stat st; /* The heuristic: 1. The symtab is null (indicating no debugging symbols) @@ -9072,7 +9072,7 @@ is_known_support_routine (struct frame_i symbols; in this case, the filename referenced by these symbols does not exists. */ - if (stat (sal.symtab->filename, &st)) + if (symtab_to_fullname (sal.symtab) == NULL) return 1; for (i = 0; known_runtime_file_name_patterns[i] != NULL; i += 1) Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.870 diff -u -p -r1.870 Makefile.in --- Makefile.in 4 Jan 2007 22:11:44 -0000 1.870 +++ Makefile.in 7 Jan 2007 07:11:52 -0000 @@ -1696,7 +1696,8 @@ ada-lang.o: ada-lang.c $(defs_h) $(gdb_s $(inferior_h) $(symfile_h) $(objfiles_h) $(breakpoint_h) \ $(gdbcore_h) $(hashtab_h) $(gdb_obstack_h) $(ada_lang_h) \ $(completer_h) $(gdb_stat_h) $(ui_out_h) $(block_h) $(infcall_h) \ - $(dictionary_h) $(exceptions_h) $(annotate_h) $(valprint_h) + $(dictionary_h) $(exceptions_h) $(annotate_h) $(valprint_h) \ + $(source_h) ada-typeprint.o: ada-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) \ $(symtab_h) $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) \ $(target_h) $(command_h) $(gdbcmd_h) $(language_h) $(demangle_h) \ --zhXaljGHf11kAtnf--