Add a quit to maint_print_all_sections

Message ID 20250306151918.2386866-1-tromey@adacore.com
State New
Headers
Series Add a quit to maint_print_all_sections |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Patch failed to apply

Commit Message

Tom Tromey March 6, 2025, 3:19 p.m. UTC
  If you have many sections, "maint print sections" can take a very long
time (due to a bug).  If you happen to "c" at the pagination prompt,
this can't be interrupted.  This patch adds a QUIT to the loop to at
least allow interruption.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32758
---
 gdb/maint.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Guinevere Larsen March 6, 2025, 7:23 p.m. UTC | #1
On 3/6/25 12:19 PM, Tom Tromey wrote:
> If you have many sections, "maint print sections" can take a very long
> time (due to a bug).  If you happen to "c" at the pagination prompt,
> this can't be interrupted.  This patch adds a QUIT to the loop to at
> least allow interruption.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32758
This patch looks pretty simple, and like a good change. Reviewed-By: 
Guinevere Larsen <guinevere@redhat.com>
  
Tom Tromey March 6, 2025, 9:07 p.m. UTC | #2
>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:

Guinevere> This patch looks pretty simple, and like a good change. Reviewed-By:
Guinevere> Guinevere Larsen <guinevere@redhat.com>

Thanks.  I'm going to check it in.

Tom
  

Patch

diff --git a/gdb/maint.c b/gdb/maint.c
index 4fc70d7d0d8..48de2079e0e 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -40,6 +40,7 @@ 
 #include "gdbsupport/selftest.h"
 #include "inferior.h"
 #include "gdbsupport/thread-pool.h"
+#include "event-top.h"
 
 #include "cli/cli-decode.h"
 #include "cli/cli-utils.h"
@@ -373,6 +374,8 @@  maint_print_all_sections (const char *header, bfd *abfd, objfile *objfile,
 
   for (asection *sect : gdb_bfd_sections (abfd))
     {
+      QUIT;
+
       obj_section *osect = nullptr;
 
       if (objfile != nullptr)