From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id D07593853D66 for ; Mon, 28 Nov 2022 17:00:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D07593853D66 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ASH0q4v019232 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Nov 2022 12:00:56 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ASH0q4v019232 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1669654857; bh=1ztxKXFLHTNak9/Iezgu16HJqRessOgj3tdZJm+fBHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dxdWVuhU+T5HYdV5HYQiRWU1QnLAV6IRkhsekgZ+M+61/sbDMd3Sj/hQxIav+Iy2H PlJ3BjDojfZm0G/K5ufXAmitQwNMjDap1gmXjm0kWStXCIs/jGz/HmosjYTaKgB+Fz /ugDHT6Cuyklr/kyptK60B2PjcnMCnKFOSw2sAS0= Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B08781E11A; Mon, 28 Nov 2022 12:00:51 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 2/2] gdb: add some debug statements to solib-svr4.c Date: Mon, 28 Nov 2022 12:00:49 -0500 Message-Id: <20221128170049.1094477-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221128170049.1094477-1-simon.marchi@polymtl.ca> References: <20221128170049.1094477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 28 Nov 2022 17:00:52 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,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: From: Simon Marchi Add a few debug statements that were useful to me when debugging why the glibc probes interface wasn't getting used. Change-Id: Ic20744f9fc80a90f196896b0829949411620c540 --- gdb/solib-svr4.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 6acaf87960bf..357059c09486 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -2168,6 +2168,9 @@ svr4_create_probe_breakpoints (svr4_info *info, struct gdbarch *gdbarch, { CORE_ADDR address = p->get_relocated_address (objfile); + solib_debug_printf ("name=%s, addr=%s", probe_info[i].name, + paddress (gdbarch, address)); + create_solib_event_breakpoint (gdbarch, address); register_solib_event_probe (info, objfile, p, address, action); } @@ -2185,6 +2188,9 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info, struct obj_section *os, bool with_prefix) { + SOLIB_SCOPED_DEBUG_START_END ("objfile=%s, with_prefix=%d", + os->objfile->original_name, with_prefix); + std::vector probes[NUM_PROBES]; for (int i = 0; i < NUM_PROBES; i++) @@ -2204,6 +2210,7 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info, } probes[i] = find_probes_in_objfile (os->objfile, "rtld", name); + solib_debug_printf ("probe=%s, num found=%zu", name, probes[i].size ()); /* The "map_failed" probe did not exist in early versions of the probes code in which the probes' @@ -2237,6 +2244,7 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info, } /* All probes found. Now create them. */ + solib_debug_printf ("using probes interface"); svr4_create_probe_breakpoints (info, gdbarch, probes, os->objfile); return true; } @@ -2262,7 +2270,11 @@ svr4_create_solib_event_breakpoints (svr4_info *info, struct gdbarch *gdbarch, if (os == nullptr || (!svr4_find_and_create_probe_breakpoints (info, gdbarch, os, false) && !svr4_find_and_create_probe_breakpoints (info, gdbarch, os, true))) - create_solib_event_breakpoint (gdbarch, address); + { + solib_debug_printf ("falling back to r_brk breakpoint: addr=%s", + paddress (gdbarch, address)); + create_solib_event_breakpoint (gdbarch, address); + } } /* Helper function for gdb_bfd_lookup_symbol. */ -- 2.38.1