From patchwork Sun Oct 2 17:04:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 58284 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B5DF3854152 for ; Sun, 2 Oct 2022 17:07:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B5DF3854152 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664730457; bh=faT3zpzxUZgoCYTOqtUgjBtGZj5gR1XUL+XSfwfAUB0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=vbycyRaeJdr438Q1DoKIR/LDusAwr347U+jVyZ/F9XDCH/DCuh5WWGcRLz7LtmLcq MicXvQWehosECE7Z1913amS+R1hmLzn/4Z3cmeqh4njApC2VIvWv3LvjW4rdNm67Cp 6pQrav3WovdaFiyaUCXyUwsJwa4hXCcuEgTWyaZs= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 1CCC3385841F for ; Sun, 2 Oct 2022 17:05:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1CCC3385841F Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-632-naHhQfrFObyHR_F_lDBGQQ-1; Sun, 02 Oct 2022 13:05:05 -0400 X-MC-Unique: naHhQfrFObyHR_F_lDBGQQ-1 Received: by mail-wm1-f69.google.com with SMTP id p36-20020a05600c1da400b003b4faefa2b9so5147587wms.6 for ; Sun, 02 Oct 2022 10:05:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=faT3zpzxUZgoCYTOqtUgjBtGZj5gR1XUL+XSfwfAUB0=; b=GGxxjBdfp9/Zp5SbhwrbJs5T61I4qNhx3UwlcMBfPS7WvIQ9JPnjnjTmDFpOnPbl8U rBujH/wegcfEx6yDkLSfITqS0qoWvyopfBOQXmXw7TAsztyExSvo2yqxKDA5mTIW/MUL MtTm6V9q3b1yAXvgeaLKgAJyXn9L1xsl3DU/HI8GJqV6HqgEDWaAZZAKHvBXIGkjGd/U PJzVQULygnBgm1tVTf/kTTeZ0+4odtbBwF9ORHYow9RMht2bgrQJ7UGrp2FY8Bg7yzsf gA8n08hi6NV9kWrOfhi2lJaGHZvsUfjq+dhyByT/IrqBPdlFZyHagPZgT0xD45OpEQ3i SdkQ== X-Gm-Message-State: ACrzQf0NWrbEzElc9crS39t8BqBLVQWQFDMpDRQyhMuULr6GjvRUqhJo fkSEwQXqiwtC1SKzPcjOIxG5kQnGiQsRlVBprHt56Z4YLNS+G8I+Cu/c8AwpSBX1p4AIVJtzmj0 MwIMvBqKwxLJuWYHEiYZWIkknKixj92svaRkuZUBVcWtArTmXyTfRaW057JBpV4ZYIAChrMPIxQ == X-Received: by 2002:a05:6000:1e12:b0:22e:37d2:95aa with SMTP id bj18-20020a0560001e1200b0022e37d295aamr1795225wrb.135.1664730303933; Sun, 02 Oct 2022 10:05:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61uRtXIY2FgG+duFMakGfqhiKXckJ6+G0X04FrKCKfgTg8t4vXFWks6DTfJZlvPexa/Ks/KA== X-Received: by 2002:a05:6000:1e12:b0:22e:37d2:95aa with SMTP id bj18-20020a0560001e1200b0022e37d295aamr1795214wrb.135.1664730303702; Sun, 02 Oct 2022 10:05:03 -0700 (PDT) Received: from localhost (52.72.115.87.dyn.plus.net. [87.115.72.52]) by smtp.gmail.com with ESMTPSA id j13-20020a5d452d000000b00228a6ce17b4sm7847271wra.37.2022.10.02.10.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Oct 2022 10:05:03 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCHv2 6/7] gdb/maint: add core file name to 'maint info program-spaces' output Date: Sun, 2 Oct 2022 18:04:47 +0100 Message-Id: <7c09a82cb88d20e3ff3449fcf854fcedb5f9ea58.1664729721.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: <20220921131200.3983844-1-aburgess@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Each program space can have an associated core file. Include this information in the output of 'maint info program-spaces'. --- gdb/NEWS | 4 ++++ gdb/doc/gdb.texinfo | 8 ++++++-- gdb/progspace.c | 18 ++++++++++++++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 796a4ef8072..a6ea7c9f98f 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -128,6 +128,10 @@ maintenance info line-table entry corresponds to an address where a breakpoint should be placed to be at the first instruction past a function's prologue. +maintenance info program-spaces + This command now includes a 'Core File' column which indicates the + name of the core file associated with each program space. + * New targets GNU/Linux/LoongArch (gdbserver) loongarch*-*-linux* diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 44d87e95748..107df84d108 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -3465,6 +3465,10 @@ the name of the executable loaded into the program space, with e.g., the @code{file} command. +@item +the name of the core file loaded into the program space, with e.g., +the @code{core-file} command. + @end enumerate @noindent @@ -3477,7 +3481,7 @@ @smallexample (@value{GDBP}) maint info program-spaces - Id Executable + Id Executable Core File * 1 hello 2 goodbye Bound inferiors: ID 1 (process 21561) @@ -3491,7 +3495,7 @@ @smallexample (@value{GDBP}) maint info program-spaces - Id Executable + Id Executable Core File * 1 vfork-test Bound inferiors: ID 2 (process 18050), ID 1 (process 18045) @end smallexample diff --git a/gdb/progspace.c b/gdb/progspace.c index 90003d964fe..4f58d44a0e6 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -251,22 +251,30 @@ print_program_space (struct ui_out *uiout, int requested) { int count = 0; + /* Start with a minimum width of 17 for the executable name column. */ + size_t longest_exec_name = 17; + /* Compute number of pspaces we will print. */ for (struct program_space *pspace : program_spaces) { if (requested != -1 && pspace->num != requested) continue; + if (pspace->exec_filename != nullptr) + longest_exec_name = std::max (strlen (pspace->exec_filename.get ()), + longest_exec_name); + ++count; } /* There should always be at least one. */ gdb_assert (count > 0); - ui_out_emit_table table_emitter (uiout, 3, count, "pspaces"); + ui_out_emit_table table_emitter (uiout, 4, count, "pspaces"); uiout->table_header (1, ui_left, "current", ""); uiout->table_header (4, ui_left, "id", "Id"); - uiout->table_header (17, ui_left, "exec", "Executable"); + uiout->table_header (longest_exec_name, ui_left, "exec", "Executable"); + uiout->table_header (17, ui_left, "core", "Core File"); uiout->table_body (); for (struct program_space *pspace : program_spaces) @@ -291,6 +299,12 @@ print_program_space (struct ui_out *uiout, int requested) else uiout->field_skip ("exec"); + if (pspace->cbfd != nullptr) + uiout->field_string ("core", bfd_get_filename (pspace->cbfd.get ()), + file_name_style.style ()); + else + uiout->field_skip ("core"); + /* Print extra info that doesn't really fit in tabular form. Currently, we print the list of inferiors bound to a pspace. There can be more than one inferior bound to the same pspace,