From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25016 invoked by alias); 2 Jun 2009 11:10:33 -0000 Received: (qmail 25005 invoked by uid 22791); 2 Jun 2009 11:10:32 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtagate8.de.ibm.com (HELO mtagate8.de.ibm.com) (195.212.29.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Jun 2009 11:10:28 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate8.de.ibm.com (8.14.3/8.13.8) with ESMTP id n52BAPCd051568 for ; Tue, 2 Jun 2009 11:10:25 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n52BAPH13084378 for ; Tue, 2 Jun 2009 13:10:25 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n52BAP7d008641 for ; Tue, 2 Jun 2009 13:10:25 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n52BAO3F008617; Tue, 2 Jun 2009 13:10:24 +0200 Message-Id: <200906021110.n52BAO3F008617@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Tue, 02 Jun 2009 13:10:24 +0200 Subject: Re: [RFC,v3] Yank out target_ops->to_sections To: pedro@codesourcery.com (Pedro Alves) Date: Tue, 02 Jun 2009 11:10:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <200905301740.02801.pedro@codesourcery.com> from "Pedro Alves" at May 30, 2009 05:40:02 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2009-06/txt/msg00016.txt.bz2 Pedro Alves wrote: > > I've been thinking for a while that the exec_ops target > > should be pushed whenever we have any kind of file loaded (main > > executable or dynamic shared module) that we can read memory > > from. It implements the file_stratum after all, and target.h says: > > > > file_stratum, /* Executable files, etc */ > > ^^^ > > I think I'm convinced this it is the best to do, design-wise. > This way, we'll still be able to read memory from shared library > sections if no main executable is loaded into GDB (e.g., gdb -c foo, > without specifying an executable needs this). > > I've given it a try, and, it does look like a cleaner solution > long term to me. Even PIE executables blur the distintion of > what is specified as main executable vs what is reported by the > dynamic loader a bit more. Another interesting fact, is that > the "vmap" bits spread about in exec.c for xcoffsolib are quite > similar in spirit to this "set of target sections we can read file > read memory from". Find below an incremental patch that applies > on top of the v2 one I posted (the changes aren't that > many: push/unpush of exec_ops moved, plus that default of > target_get_section_table you pointed out goes away, replaced by > the exec_ops target returning the current set of target sections). > At the bottom there's the new v3 combined patch. > > Please let me know what you think about this. Re-tested on x86_64-linux. I think this makes sense. Your new combined patch looks good to me. > Index: src/gdb/exec.c > =================================================================== > --- src.orig/gdb/exec.c 2009-05-30 17:24:30.000000000 +0100 > +++ src/gdb/exec.c 2009-05-30 17:24:47.000000000 +0100 > @@ -71,6 +71,15 @@ struct target_ops exec_ops; > bfd *exec_bfd = NULL; > long exec_bfd_mtime = 0; > > +/* GDB currently only supports a single symbol/address space for the > + whole debug session. When that limitation is lifted, this global > + goes away. */ > +static struct target_section_table current_target_sections_1; > + > +/* The set of target sections matching the sections mapped into the > + current inferior's address space. */ > +struct target_section_table *current_target_sections = ¤t_target_sections_1; This can be "static" now, right? Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com