From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by sourceware.org (Postfix) with ESMTPS id 8116D3857C63 for ; Sun, 4 Oct 2020 08:29:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8116D3857C63 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x442.google.com with SMTP id j2so6238069wrx.7 for ; Sun, 04 Oct 2020 01:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9qldqTJSTPQexP1g3KJ/u7XJsv7buXbdryH2EGTJLXQ=; b=DsUrIHJgtIZBDCMtnX0JTqmooJ3vtfzhMxUA3QX1Iq8l2fmPZjZDM+qFk1LjgBE3DL RiajSMe+1cYtfgw2Qk7PFCdE0qkMYegG4iy5PUNVD3Qv3lAQ584Ga6IqlRPh6wgQD7qv J0wbfarUeXeHXopU5/39ExITlVkj5yH36mtnbInOETJEUn0uUz6jNbyRWbHQ4jVYqzlW rLD3rR7gJQpDiaPnMwjLmwpt5Pqi7GfnT5MsPgvKQKqNzDc0uc1F4YSpZivn5dhgDZAz Nt/9z4dNz2wK0pL3jGYfsW5lT35jubOrOsw3t+moyb4qgr4klYAnkXAdz0xSKJkMRzED YEfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9qldqTJSTPQexP1g3KJ/u7XJsv7buXbdryH2EGTJLXQ=; b=NDaT/U3YGEWKq32iyo5A055HN/p8ndPwt+MA4iGOcoYm3oBGVYuemfQ2dWCmuaYEOn Qg2JLzhgbtYZRGb4vkvPIqvvhqFFRH0OhVYnkIauPdc9wmebWLBpDk9aQsY4Qrx4HFhR igYwPItU2BA51DyYV07iE4lhvASOPb0opl28Qorhdb3toBakXWHNYRS61vcA38sBl4JH wh/GOn91OmC9ppdi7tHaG0FozazlMKo1h/yPJorlFe4jAIHxwjJDxw9tBT3USO5S31mg LLvbu0GhEoezu3Qm7GrxW3Nj3Ngx/YynISKZW0Yr9nCJdKSsO3WmxmMaEAFcu8vghP6N 3ptg== X-Gm-Message-State: AOAM533QtqvToROShIEaQa4vceGpIkG26x7nQTyTZd2rUQ2CHRwIRlBB EP+xywukwJzoAWc1V+glCQ+QgxGfsVT+oA== X-Google-Smtp-Source: ABdhPJxH3sukCf3GOh3PTXA9L48v3fjwWj1rlz17ke1NsPHlx5g9WZvWrvbP8m6zO8Ozo9cLl7tvXA== X-Received: by 2002:a5d:574a:: with SMTP id q10mr11451257wrw.127.1601800165548; Sun, 04 Oct 2020 01:29:25 -0700 (PDT) Received: from localhost (host109-151-23-62.range109-151.btcentralplus.com. [109.151.23.62]) by smtp.gmail.com with ESMTPSA id f5sm7791517wmh.16.2020.10.04.01.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Oct 2020 01:29:24 -0700 (PDT) Date: Sun, 4 Oct 2020 09:29:23 +0100 From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/6] Introduce target-section.h Message-ID: <20201004082923.GA605036@embecosm.com> References: <20201003193735.2532-1-tom@tromey.com> <20201003193735.2532-2-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201003193735.2532-2-tom@tromey.com> X-Operating-System: Linux/5.8.12-100.fc31.x86_64 (x86_64) X-Uptime: 09:27:11 up 23:39, 1 user, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Oct 2020 08:29:28 -0000 * Tom Tromey [2020-10-03 13:37:30 -0600]: > This introduces a new target-section.h file. This makes some of the > later patches in this series a bit cleaner, because new includes of > target.h won't be required. Also I think it's better to have small > header files for each separate data structure. > > gdb/ChangeLog > 2020-10-03 Tom Tromey > > * target.h (struct target_section, struct target_section_table): > Move to target-section.h. > * target-section.h: New file. > --- > gdb/ChangeLog | 6 ++++++ > gdb/target-section.h | 50 ++++++++++++++++++++++++++++++++++++++++++++ > gdb/target.h | 28 +------------------------ > 3 files changed, 57 insertions(+), 27 deletions(-) > create mode 100644 gdb/target-section.h > > diff --git a/gdb/target-section.h b/gdb/target-section.h > new file mode 100644 > index 00000000000..581bc1dbe9f > --- /dev/null > +++ b/gdb/target-section.h > @@ -0,0 +1,50 @@ > +/* Target sections. > + > + Copyright (C) 2020 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#ifndef GDB_TARGET_SECTION_H > +#define GDB_TARGET_SECTION_H > + > +/* Struct target_section maps address ranges to file sections. It is > + mostly used with BFD files, but can be used without (e.g. for handling > + raw disks, or files not in formats handled by BFD). */ > + > +struct target_section > + { > + CORE_ADDR addr; /* Lowest address in section */ > + CORE_ADDR endaddr; /* 1+highest address in section */ > + > + struct bfd_section *the_bfd_section; > + > + /* The "owner" of the section. > + It can be any unique value. It is set by add_target_sections > + and used by remove_target_sections. > + For example, for executables it is a pointer to exec_bfd and > + for shlibs it is the so_list pointer. */ > + void *owner; > + }; I know that this is copy & paste code, but it would be awesome if we could take this opportunity to fix the whitespace formatting, place the comments in the correct place, reword them as proper sentences, and add a comment to the missing field. Generally bring this code up to our current coding standard :) Otherwise this looks great. Thanks, Andrew > + > +/* Holds an array of target sections. Defined by [SECTIONS..SECTIONS_END[. */ > + > +struct target_section_table > +{ > + struct target_section *sections; > + struct target_section *sections_end; > +}; > + > +#endif /* GDB_TARGET_SECTION_H */ > diff --git a/gdb/target.h b/gdb/target.h > index 695f1b2b7f6..369394aa929 100644 > --- a/gdb/target.h > +++ b/gdb/target.h > @@ -44,6 +44,7 @@ struct inferior; > #include "breakpoint.h" /* For enum bptype. */ > #include "gdbsupport/scoped_restore.h" > #include "gdbsupport/refcounted-object.h" > +#include "target-section.h" > > /* This include file defines the interface between the main part > of the debugger, and the part which is target-specific, or > @@ -2413,33 +2414,6 @@ extern bool target_is_pushed (target_ops *t); > extern CORE_ADDR target_translate_tls_address (struct objfile *objfile, > CORE_ADDR offset); > > -/* Struct target_section maps address ranges to file sections. It is > - mostly used with BFD files, but can be used without (e.g. for handling > - raw disks, or files not in formats handled by BFD). */ > - > -struct target_section > - { > - CORE_ADDR addr; /* Lowest address in section */ > - CORE_ADDR endaddr; /* 1+highest address in section */ > - > - struct bfd_section *the_bfd_section; > - > - /* The "owner" of the section. > - It can be any unique value. It is set by add_target_sections > - and used by remove_target_sections. > - For example, for executables it is a pointer to exec_bfd and > - for shlibs it is the so_list pointer. */ > - void *owner; > - }; > - > -/* Holds an array of target sections. Defined by [SECTIONS..SECTIONS_END[. */ > - > -struct target_section_table > -{ > - struct target_section *sections; > - struct target_section *sections_end; > -}; > - > /* Return the "section" containing the specified address. */ > struct target_section *target_section_by_addr (struct target_ops *target, > CORE_ADDR addr); > -- > 2.17.2 >