From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by sourceware.org (Postfix) with ESMTPS id 07A853858CDB for ; Thu, 18 Apr 2024 07:37:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 07A853858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 07A853858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713425839; cv=none; b=OqBI7AKl5LhifuwxUsCwzTjruATieVjywmC9xrtlP8VH/TUBdoKL3CyFYFD9GydV+UX0kufKNhKvH+jVC2tvtdU5eqXZLYyEPjuxF0rVn7WcRXweDL6uu9f8I+WBCcApTMYHD4Ym6OmdFUm77z6J54fa4QMDfu1kO/4fJdEK1J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713425839; c=relaxed/simple; bh=yOjRnimcihMmS0oWBygxVdfj7DxKckuP+QOD/EfHOWg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=JhHLBE8J+FGjVFpWfUZnVJ7lhsAxXseh8POm76o3LbddQBzW9VzBDqUiGUZR3uE7okivM+jng4MPaFrIxD06HDA5Gmszyvk0KH2iyx1cPPapS7cxjZhu2Pp3gPRId4ZD2fMyxCKJgCQyA4Xce6Afb5qpkT5Y4xq+u/hAdJAwVQc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713425834; x=1744961834; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=yOjRnimcihMmS0oWBygxVdfj7DxKckuP+QOD/EfHOWg=; b=Uph43X/j/346rc1BPZh/Rc5yjv6BShqN2VVcfp2TKuwdRpy20Vc8Rvdi /LsH9PoZglZl+Nf2gHgKXj90RaFRJuZ0FlnLuBqzqGx5hXt0GdcosvAyJ V0U/0wApp0gWPuRkaYQa0td5IfzlFXs1rwvHj9Ff0BUFbO75nv5FDE1cb afYYDcmU+N6jpXOrnJ+KlEuVszPRKYoSxnXOQ6/zBgMPmQZkSEVUQTEo6 lXiOy8ubQKhiHeUg9qnjgNJseeeEZ69IUR6QjOGhQndirs4DULhBzOReW W2wVoV8yn8CPmP0awPRCw4pvSHkgs4C0SQxTt+QGlTbJAoQSHK4NmK+CO g==; X-CSE-ConnectionGUID: Udsd3IDoRPiSjhWDvQjSnw== X-CSE-MsgGUID: /N2tq/uNSwC+9RWdy0WRwA== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19561442" X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="19561442" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 00:37:13 -0700 X-CSE-ConnectionGUID: kEL1ZSWqSUKJjUgX0tfDkA== X-CSE-MsgGUID: gHODM5uhTfSJfcdS88QBSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="27520278" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 00:37:13 -0700 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH 1/3] gdb: print target in print_target_wait_results Date: Thu, 18 Apr 2024 09:36:36 +0200 Message-Id: <826cf9b023a263f6905f877c3bf16e1c5832186c.1713423838.git.tankut.baris.aktemur@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: Extend `print_target_wait_results` to print the target from which the wait result came. --- gdb/infrun.c | 27 ++++++++++++++++++++++----- gdb/infrun.h | 3 ++- gdb/remote.c | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index a5030b16376..3dbd42f81cb 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3979,7 +3979,8 @@ delete_just_stopped_threads_single_step_breakpoints (void) void print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid, - const struct target_waitstatus &ws) + const struct target_waitstatus &ws, + process_stratum_target *proc_target) { infrun_debug_printf ("target_wait (%s [%s], status) =", waiton_ptid.to_string ().c_str (), @@ -3988,6 +3989,20 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid, result_ptid.to_string ().c_str (), target_pid_to_str (result_ptid).c_str ()); infrun_debug_printf (" %s", ws.to_string ().c_str ()); + + if (proc_target != nullptr) + infrun_debug_printf (" from target %d (%s)", + proc_target->connection_number, + proc_target->shortname ()); +} + +/* Wrapper for print_target_wait_results above for convenience. */ + +static void +print_target_wait_results (ptid_t waiton_ptid, + const execution_control_state &ecs) +{ + print_target_wait_results (waiton_ptid, ecs.ptid, ecs.ws, ecs.target); } /* Select a thread at random, out of those which are resumed and have @@ -4339,7 +4354,8 @@ prepare_for_detach (void) event.ptid = do_target_wait_1 (inf, pid_ptid, &event.ws, 0); if (debug_infrun) - print_target_wait_results (pid_ptid, event.ptid, event.ws); + print_target_wait_results (pid_ptid, event.ptid, event.ws, + event.target); handle_one (event); } @@ -4395,7 +4411,7 @@ wait_for_inferior (inferior *inf) ecs.target = inf->process_target (); if (debug_infrun) - print_target_wait_results (minus_one_ptid, ecs.ptid, ecs.ws); + print_target_wait_results (minus_one_ptid, ecs); /* Now figure out what to do with the result of the result. */ handle_inferior_event (&ecs); @@ -4676,7 +4692,7 @@ fetch_inferior_event () switch_to_target_no_thread (ecs.target); if (debug_infrun) - print_target_wait_results (minus_one_ptid, ecs.ptid, ecs.ws); + print_target_wait_results (minus_one_ptid, ecs); /* If an error happens while handling the event, propagate GDB's knowledge of the executing state to the frontend/user running @@ -5239,7 +5255,8 @@ poll_one_curr_target (struct target_waitstatus *ws) event_ptid = target_wait (minus_one_ptid, ws, TARGET_WNOHANG); if (debug_infrun) - print_target_wait_results (minus_one_ptid, event_ptid, *ws); + print_target_wait_results (minus_one_ptid, event_ptid, *ws, + current_inferior ()->process_target ()); return event_ptid; } diff --git a/gdb/infrun.h b/gdb/infrun.h index 5f83ca2b4c3..0dc26ae2c33 100644 --- a/gdb/infrun.h +++ b/gdb/infrun.h @@ -256,7 +256,8 @@ extern void print_stop_event (struct ui_out *uiout, bool displays = true); /* Pretty print the results of target_wait, for debugging purposes. */ extern void print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid, - const struct target_waitstatus &ws); + const struct target_waitstatus &ws, + process_stratum_target *proc_target); extern int signal_stop_state (int); diff --git a/gdb/remote.c b/gdb/remote.c index 5c9fdebcdbe..fdf45abf2ee 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -4860,7 +4860,7 @@ remote_target::process_initial_stop_replies (int from_tty) event_ptid = target_wait (waiton_ptid, &ws, TARGET_WNOHANG); if (remote_debug) - print_target_wait_results (waiton_ptid, event_ptid, ws); + print_target_wait_results (waiton_ptid, event_ptid, ws, this); switch (ws.kind ()) { -- 2.34.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928