diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-09-08 11:20:25 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-09-15 10:16:52 +0100 |
commit | 5a6dafd5f1110e8b642fdf65c13d8543e469a09e (patch) | |
tree | c4ea19c423cceee5ba65e15b710092857ff902ed /ld/ldwrite.c | |
parent | 7d9931cc31b9adea7207e41d28e632c951134de8 (diff) | |
download | gdb-5a6dafd5f1110e8b642fdf65c13d8543e469a09e.zip gdb-5a6dafd5f1110e8b642fdf65c13d8543e469a09e.tar.gz gdb-5a6dafd5f1110e8b642fdf65c13d8543e469a09e.tar.bz2 |
gdb: small cleanup in symbol_file_add_with_addrs
While looking at how gdb::observers::new_objfile was used, I found
some code in symbol_file_add_with_addrs that I thought could be
improved.
Instead of:
if (condition)
{
...
return;
}
...
return;
Where some parts of '...' identical between the two branches. I think
it would be nicer if the duplication is removed, and we just use:
if (!condition)
...
to guard the one statement that should only happen when the condition
is not true.
There is one change in this commit though that is (possibly)
significant, there is a call to bfd_cache_close_all() that was only
present in the second block. After this commit we now call that
function for both paths.
The call to bfd_cache_close_all was added in commit:
commit ce7d45220e4ed342d4a77fcd2f312e85e1100971
Date: Fri Jul 30 12:05:45 2004 +0000
with the purpose of ensuring that GDB doesn't hold the BFDs open
unnecessarily, thus preventing the files from being updated on some
hosts (e.g. Win32).
In the early exit case we previously didn't call bfd_cache_close_all,
with the result that GDB would continue to hold open some BFD objects
longer than needed.
After this commit, but calling bfd_cache_close_all for both paths this
problem is solved.
I'm not sure how this change could be tested, I don't believe there's
any GDB (maintenance) command that displays the BFD cache contents, so
we can't check the cache contents easily. Ideas are welcome though.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'ld/ldwrite.c')
0 files changed, 0 insertions, 0 deletions