From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 460C4384F48C for ; Fri, 18 Nov 2022 16:43:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 460C4384F48C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668789793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WZUuOCiTOxFarp3LlY+C9CwQpj5gZiOxE8L653t6ykI=; b=TZ2wl6HbKYBhqfzLOkdOk//rX/Saay+iQiWAQiJIR2CeCKRULsdyYOqYHfPbqXVM8fg4lo 64A1HQpIAk71oAsYDmtrm+m6/JIUGdpQLZZKshVXnrVDdnmNUb6uwdOGc3qdUo+m4Q7cux x+VIuTidR4HXxm1EVDkXlVynS4NvjVE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-145-2CHbb0sqOX-38S3wLu3wSQ-1; Fri, 18 Nov 2022 11:43:12 -0500 X-MC-Unique: 2CHbb0sqOX-38S3wLu3wSQ-1 Received: by mail-wm1-f72.google.com with SMTP id r186-20020a1c44c3000000b003d0005ff848so2396315wma.2 for ; Fri, 18 Nov 2022 08:43:12 -0800 (PST) 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:message-id:reply-to; bh=WZUuOCiTOxFarp3LlY+C9CwQpj5gZiOxE8L653t6ykI=; b=DgyS/zm7uxyonfv5VkJ5+AlleAaC/eEhEkYeXOZ0LMMzzMakqkfY17uipncFqh0Sl4 /YiKCsYLU3nLLFzVLv1GSlMRwHBRwSfAoPkJPhb+K1Xn62RiXISCAcvurkwBPI7Su+AX Sch57UpQptewtdPlIvtykYikCuC+ivp636pSLMJhnGbdC0n9fPoUzznFCQhGREbDgIBD dRaphtvFnYDzbNvGMuck5EmgTvgEQAivWSk2HABxdNSwSjUmM/ozHnhWlXr+3dkrqk1l O8gUy4DCfylmjFTVDwq3tjt0KArKAuaFEqtJdySjTPTIXGkaXtbeevYmSN3+jwim1vEQ GbIw== X-Gm-Message-State: ANoB5pl5zl+DZSwl54Xjaz9CutbMwUWp2K794xw7dj5wl98FA2IkR3kv l4K4USB+kX6NP5MzBaWBbh5WNqgdq+alrwPq0ZrECmVjqcLvznjko3DT7emvf0K+I3+CIliygpG KNerZ6WLItiXpUUlhjPxErvit7R8vhefn+r15yYdeB27Od97Z4FoGd5B+X2/lrrxzuivx9Nltrw == X-Received: by 2002:a1c:4c0c:0:b0:3cf:9881:e9d9 with SMTP id z12-20020a1c4c0c000000b003cf9881e9d9mr5576173wmf.6.1668789791091; Fri, 18 Nov 2022 08:43:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ZISjEmImk8he11pPCUWMlBgmXc0c64VMHVktS29JTDbMDi+sxqiapblm4XpXxJLGqGFkb2Q== X-Received: by 2002:a1c:4c0c:0:b0:3cf:9881:e9d9 with SMTP id z12-20020a1c4c0c000000b003cf9881e9d9mr5576157wmf.6.1668789790793; Fri, 18 Nov 2022 08:43:10 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id n1-20020a5d6b81000000b00226dba960b4sm3989476wrx.3.2022.11.18.08.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:43:10 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 6/7] gdb/maint: add core file name to 'maint info program-spaces' output Date: Fri, 18 Nov 2022 16:42:57 +0000 Message-Id: <6e8ccd780e088af4a3e9f822aad10d1ff72132f9.1668789658.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 List-Id: 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 424e5ffd829..8176940ae1a 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -146,6 +146,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 bb7b2764408..566da9e7d92 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, -- 2.25.4