From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 1/6] Introduce target-section.h
Date: Sat, 3 Oct 2020 13:37:30 -0600 [thread overview]
Message-ID: <20201003193735.2532-2-tom@tromey.com> (raw)
In-Reply-To: <20201003193735.2532-1-tom@tromey.com>
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 <tom@tromey.com>
* 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 <http://www.gnu.org/licenses/>. */
+
+#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;
+ };
+
+/* 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
next prev parent reply other threads:[~2020-10-03 19:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-03 19:37 [PATCH 0/6] Change target section table management Tom Tromey
2020-10-03 19:37 ` Tom Tromey [this message]
2020-10-04 8:29 ` [PATCH 1/6] Introduce target-section.h Andrew Burgess
2020-10-09 1:17 ` Tom Tromey
2020-10-03 19:37 ` [PATCH 2/6] Use a std::vector in target_section_table Tom Tromey
2020-10-13 16:41 ` Luis Machado
2020-10-13 20:35 ` Tom Tromey
2020-10-13 22:48 ` Luis Machado
2020-10-14 12:58 ` Tom Tromey
2020-10-14 13:01 ` Luis Machado
2020-10-14 13:18 ` Tom Tromey
2020-10-14 13:23 ` Luis Machado
2020-10-14 14:06 ` Simon Marchi
2020-10-14 9:09 ` Tom de Vries
2020-11-10 17:38 ` Simon Marchi
2020-10-03 19:37 ` [PATCH 3/6] build_section_table cannot fail Tom Tromey
2020-10-04 8:38 ` Andrew Burgess
2020-10-03 19:37 ` [PATCH 4/6] Simplify add_target_sections_of_objfile Tom Tromey
2020-10-04 8:40 ` Andrew Burgess
2020-10-03 19:37 ` [PATCH 5/6] Remove clear_section_table Tom Tromey
2020-10-04 8:44 ` Andrew Burgess
2020-10-03 19:37 ` [PATCH 6/6] Change target_section_table to std::vector alias Tom Tromey
2020-10-04 8:46 ` Andrew Burgess
2020-10-13 2:19 ` [PATCH 0/6] Change target section table management Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201003193735.2532-2-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).