From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 4/9] Remove exec_bfd_mtime define
Date: Tue, 21 Jul 2020 21:34:39 -0600 [thread overview]
Message-ID: <20200722033444.18522-5-tom@tromey.com> (raw)
In-Reply-To: <20200722033444.18522-1-tom@tromey.com>
This removes the exec_bfd_mtime define, in favor of directly using the
appropriate member of the current program space.
gdb/ChangeLog
2020-07-21 Tom Tromey <tom@tromey.com>
* source-cache.c (source_cache::get_plain_source_lines): Use
current_program_space.
* corefile.c (reopen_exec_file): Use current_program_space.
* exec.c (exec_file_attach): Use current_program_space.
* exec.h (exec_bfd_mtime): Remove.
---
gdb/ChangeLog | 8 ++++++++
gdb/corefile.c | 4 +++-
gdb/exec.c | 2 +-
gdb/exec.h | 1 -
gdb/source-cache.c | 2 +-
5 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/gdb/corefile.c b/gdb/corefile.c
index c1eec199342..1586e9f175a 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -115,7 +115,9 @@ reopen_exec_file (void)
std::string filename = bfd_get_filename (exec_bfd);
res = stat (filename.c_str (), &st);
- if (res == 0 && exec_bfd_mtime && exec_bfd_mtime != st.st_mtime)
+ if (res == 0
+ && current_program_space->ebfd_mtime
+ && current_program_space->ebfd_mtime != st.st_mtime)
exec_file_attach (filename.c_str (), 0);
else
/* If we accessed the file since last opening it, close it now;
diff --git a/gdb/exec.c b/gdb/exec.c
index a395b58da82..6ca867ab53e 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -491,7 +491,7 @@ exec_file_attach (const char *filename, int from_tty)
bfd_errmsg (bfd_get_error ()));
}
- exec_bfd_mtime = bfd_get_mtime (exec_bfd);
+ current_program_space->ebfd_mtime = bfd_get_mtime (exec_bfd);
validate_files ();
diff --git a/gdb/exec.h b/gdb/exec.h
index daaf0d0d4a7..db03f3a24fb 100644
--- a/gdb/exec.h
+++ b/gdb/exec.h
@@ -31,7 +31,6 @@ struct bfd;
struct objfile;
#define exec_bfd current_program_space->ebfd
-#define exec_bfd_mtime current_program_space->ebfd_mtime
/* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
Returns 0 if OK, 1 on error. */
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 9196e3a19e3..c67d087c76d 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -69,7 +69,7 @@ source_cache::get_plain_source_lines (struct symtab *s,
if (SYMTAB_OBJFILE (s) != NULL && SYMTAB_OBJFILE (s)->obfd != NULL)
mtime = SYMTAB_OBJFILE (s)->mtime;
else if (exec_bfd)
- mtime = exec_bfd_mtime;
+ mtime = current_program_space->ebfd_mtime;
if (mtime && mtime < st.st_mtime)
warning (_("Source file is more recent than executable."));
--
2.17.2
next prev parent reply other threads:[~2020-07-22 3:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 3:34 [PATCH 0/9] Remove some macros from exec.h and progspace.h Tom Tromey
2020-07-22 3:34 ` [PATCH 1/9] Remove exec_filename macro Tom Tromey
2020-07-22 3:34 ` [PATCH 2/9] Change exec_close to be a method on program_space Tom Tromey
2020-07-22 3:34 ` [PATCH 3/9] Remove commented-out code from gcore.c Tom Tromey
2020-07-22 3:34 ` Tom Tromey [this message]
2020-07-22 3:34 ` [PATCH 5/9] Remove current_target_sections macro Tom Tromey
2020-07-22 12:20 ` Simon Marchi
2020-07-22 12:39 ` Simon Marchi
2020-07-22 14:11 ` Tom Tromey
2020-07-22 3:34 ` [PATCH 6/9] Don't change current program space in exec_target::close Tom Tromey
2020-07-22 12:22 ` Simon Marchi
2020-07-22 3:34 ` [PATCH 7/9] Remove the exec_bfd macro Tom Tromey
2020-07-22 3:34 ` [PATCH 8/9] Change program_space::ebfd to a gdb_bfd_ref_ptr Tom Tromey
2020-07-22 3:34 ` [PATCH 9/9] Remove symfile_objfile macro Tom Tromey
2020-07-22 12:38 ` [PATCH 0/9] Remove some macros from exec.h and progspace.h Simon Marchi
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=20200722033444.18522-5-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