Message ID | 20190227201849.32210-22-tom@tromey.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
On 02/27/2019 08:18 PM, Tom Tromey wrote: > This replaces a try/catch in write_gcore_file with a use of SCOPE_EXIT > instead. I find that this is simpler to understand. > > gdb/ChangeLog > 2019-02-27 Tom Tromey <tom@tromey.com> > > * gcore.c (write_gcore_file): Use SCOPE_EXIT. You could rebase this on current master and push it in, to get it out of the way. You could also merge patches #1-#13, the cleanup-elimination patches until the TRY/CATCH parts. I'll need a bit more time to comment on those TRY/CATCH parts, so I've skipped them tonight. Thanks, Pedro Alves
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> You could rebase this on current master and push it in, to get it
Pedro> out of the way.
Unless there's a need, I'd rather leave it as-is, since rebasing it
earlier means tweaking other patches earlier in the series.
Pedro> You could also merge patches #1-#13, the cleanup-elimination patches
Pedro> until the TRY/CATCH parts. I'll need a bit more time to comment
Pedro> on those TRY/CATCH parts, so I've skipped them tonight.
I don't mind waiting, it's not a super rush to get this in.
Thanks for looking through these.
Tom
-- Thanks, Pedro Alves On 03/06/2019 10:31 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes: > > Pedro> You could rebase this on current master and push it in, to get it > Pedro> out of the way. > > Unless there's a need, I'd rather leave it as-is, since rebasing it > earlier means tweaking other patches earlier in the series. The only tweak othe other patches would need would be to not touch the file at all. This patch eliminates the need for any of the previous changes to the same code. > > Pedro> You could also merge patches #1-#13, the cleanup-elimination patches > Pedro> until the TRY/CATCH parts. I'll need a bit more time to comment > Pedro> on those TRY/CATCH parts, so I've skipped them tonight. > > I don't mind waiting, it's not a super rush to get this in. > Thanks for looking through these. I'd think getting the cleanups elimination patches in would be good for the fact that it makes it impossible for anyone else to end up adding new cleanups meanwhile. And, it makes the remainder patches a smaller self-contained series; any new repost would be much smaller. Thanks, Pedro Alves
>> I don't mind waiting, it's not a super rush to get this in. >> Thanks for looking through these. Pedro> I'd think getting the cleanups elimination patches in would be Pedro> good for the fact that it makes it impossible for anyone else to Pedro> end up adding new cleanups meanwhile. And, it makes the remainder Pedro> patches a smaller self-contained series; any new repost would be Pedro> much smaller. Ok, I will try to do that either tonight or tomorrow. Tom
Tom> Ok, I will try to do that either tonight or tomorrow. Those are in now, let me know if there are problems. thanks, Tom
diff --git a/gdb/gcore.c b/gdb/gcore.c index 0e4596241b7..21d9ee88671 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -37,6 +37,7 @@ #include <algorithm> #include "common/gdb_unlinker.h" #include "common/byte-vector.h" +#include "common/scope-exit.h" /* The largest amount of memory to read from the target at once. We must throttle it to limit the amount of memory used by GDB during @@ -114,23 +115,9 @@ write_gcore_file_1 (bfd *obfd) void write_gcore_file (bfd *obfd) { - struct gdb_exception except = exception_none; - target_prepare_to_generate_core (); - - try - { - write_gcore_file_1 (obfd); - } - catch (const struct gdb_exception &e) - { - except = e; - } - - target_done_generating_core (); - - if (except.reason < 0) - throw_exception (except); + SCOPE_EXIT { target_done_generating_core (); }; + write_gcore_file_1 (obfd); } /* gcore_command -- implements the 'gcore' command.