aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-12-13 08:52:57 +1030
committerAlan Modra <amodra@gmail.com>2024-12-13 13:56:15 +1030
commitd2cca35960319a7a0087ffda4beb679a23181df4 (patch)
treef3658394b46536819301b2fc9862b4ea795efc5d
parent27e69fa7e921760de0736355b9d8b7d1f3901486 (diff)
downloadgdb-d2cca35960319a7a0087ffda4beb679a23181df4.zip
gdb-d2cca35960319a7a0087ffda4beb679a23181df4.tar.gz
gdb-d2cca35960319a7a0087ffda4beb679a23181df4.tar.bz2
objdump: Delete close optimisation
In commit cd6581da62c3, Nick made an optimisation that was reasonable at the time, but then pr22032 came along and commit 7c0ed39626e3 made bfd_close_all_done free memory. So Nick's optimisation is now ineffective, and the comment wrong. * objdump.c (display_file): Delete last_file param. Update caller. Call bfd_close always.
-rw-r--r--binutils/objdump.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index f409d67..5e68324 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -5932,7 +5932,7 @@ display_any_bfd (bfd *file, int level)
}
static void
-display_file (char *filename, char *target, bool last_file)
+display_file (char *filename, char *target)
{
bfd *file;
@@ -5951,18 +5951,7 @@ display_file (char *filename, char *target, bool last_file)
display_any_bfd (file, 0);
- /* This is an optimization to improve the speed of objdump, especially when
- dumping a file with lots of associated debug informatiom. Calling
- bfd_close on such a file can take a non-trivial amount of time as there
- are lots of lists to walk and buffers to free. This is only really
- necessary however if we are about to load another file and we need the
- memory back. Otherwise, if we are about to exit, then we can save (a lot
- of) time by only doing a quick close, and allowing the OS to reclaim the
- memory for us. */
- if (! last_file)
- bfd_close (file);
- else
- bfd_close_all_done (file);
+ bfd_close (file);
}
int
@@ -6362,11 +6351,11 @@ main (int argc, char **argv)
else
{
if (optind == argc)
- display_file ("a.out", target, true);
+ display_file ("a.out", target);
else
for (; optind < argc;)
{
- display_file (argv[optind], target, optind == argc - 1);
+ display_file (argv[optind], target);
optind++;
}
}