From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11778 invoked by alias); 8 Oct 2013 18:23:09 -0000 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 Received: (qmail 11768 invoked by uid 89); 8 Oct 2013 18:23:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2013 18:23:08 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r98IN6c1024503 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Oct 2013 14:23:06 -0400 Received: from host2.jankratochvil.net (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r98IN1i8013748 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 8 Oct 2013 14:23:04 -0400 Date: Tue, 08 Oct 2013 18:23:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: Doug Evans , gdb-patches@sourceware.org Subject: [patch] OBJF_NOT_FILENAME [Re: [RFC] Record objfile->original_name as an absolute path] Message-ID: <20131008182301.GA27355@host2.jankratochvil.net> References: <20130926084713.GA11031@host2.jankratochvil.net> <87siwqcayo.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87siwqcayo.fsf@fleche.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00232.txt.bz2 On Fri, 27 Sep 2013 21:37:35 +0200, Tom Tromey wrote: > I've wanted an objfile flag for a while that would indicate whether the > underlying BFD corresponds to a file or some other thing. > Right now I think you can see lookups of bogusly-named files coming from > the Python auto-loader. That's true, for example for gdb.base/jit.exp: open("-gdb.gdb", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/lib/debug-gdb.gdb", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/usr/share/gdb/auto-load-gdb.gdb", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) etc. I will integrate it with add-ons to the Doug's patch. No regressions on {x86_64,x86_64-m32,i686}-fedora21pre-linux-gnu. Thanks, Jan gdb/ 2013-10-08 Jan Kratochvil New flag OBJF_NOT_FILENAME. * auto-load.c (auto_load_objfile_script): Check also OBJF_NOT_FILENAME. * jit.c (jit_object_close_impl): Use OBJF_NOT_FILENAME for allocate_objfile. (jit_bfd_try_read_symtab): Use OBJF_NOT_FILENAME for symbol_file_add_from_bfd. * jv-lang.c (get_dynamics_objfile): Use OBJF_NOT_FILENAME for allocate_objfile. * objfiles.c (allocate_objfile): Assert OBJF_NOT_FILENAME if NAME is NULL. * objfiles.h (OBJF_NOT_FILENAME): New. diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 6d0d6d9..4eb7cdd 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -840,7 +840,7 @@ auto_load_objfile_script (struct objfile *objfile, void load_auto_scripts_for_objfile (struct objfile *objfile) { - if (!global_auto_load) + if (!global_auto_load || (objfile->flags & OBJF_NOT_FILENAME) != 0) return; if (auto_load_gdb_scripts) diff --git a/gdb/jit.c b/gdb/jit.c index c7edd4a..ba0be5e 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -785,7 +785,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb, priv_data = cb->priv_data; - objfile = allocate_objfile (NULL, "<< JIT compiled code >>", 0); + objfile = allocate_objfile (NULL, "<< JIT compiled code >>", + OBJF_NOT_FILENAME); objfile->per_bfd->gdbarch = target_gdbarch (); terminate_minimal_symbol_table (objfile); @@ -926,7 +927,7 @@ JITed symbol file is not an object file, ignoring it.\n")); /* This call does not take ownership of SAI. */ make_cleanup_bfd_unref (nbfd); objfile = symbol_file_add_from_bfd (nbfd, bfd_get_filename (nbfd), 0, sai, - OBJF_SHARED, NULL); + OBJF_SHARED | OBJF_NOT_FILENAME, NULL); do_cleanups (old_cleanups); add_objfile_entry (objfile, entry_addr); diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 0d07bbd..63bcc98 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -118,7 +118,8 @@ get_dynamics_objfile (struct gdbarch *gdbarch) /* Mark it as shared so that it is cleared when the inferior is re-run. */ - dynamics_objfile = allocate_objfile (NULL, NULL, OBJF_SHARED); + dynamics_objfile = allocate_objfile (NULL, NULL, + OBJF_SHARED | OBJF_NOT_FILENAME); dynamics_objfile->per_bfd->gdbarch = gdbarch; data = XCNEW (struct jv_per_objfile_data); diff --git a/gdb/objfiles.c b/gdb/objfiles.c index a10540a..d1f3121 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -289,6 +289,7 @@ allocate_objfile (bfd *abfd, const char *name, int flags) if (name == NULL) { gdb_assert (abfd == NULL); + gdb_assert ((flags & OBJF_NOT_FILENAME) != 0); name = "<>"; } objfile->original_name = obstack_copy0 (&objfile->objfile_obstack, name, diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 8586e5a..281a698 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -429,6 +429,11 @@ struct objfile #define OBJF_MAINLINE (1 << 5) +/* ORIGINAL_NAME and OBFD->FILENAME correspong to text description unrelated to + filesystem names. It can be for example "". */ + +#define OBJF_NOT_FILENAME (1 << 6) + /* Declarations for functions defined in objfiles.c */ extern struct objfile *allocate_objfile (bfd *, const char *name, int);