From patchwork Mon Nov 28 17:00:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61175 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 724D83839D89 for ; Mon, 28 Nov 2022 17:01:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 724D83839D89 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669654886; bh=1ztxKXFLHTNak9/Iezgu16HJqRessOgj3tdZJm+fBHw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=yKfU4WqQjDCf8v5Hdx7XGJa/EkaUmJiTG2qwtnimMaUjlSH1tJBcAy3LWEhi08eJu nmWq+gRbZEZANcaA9DKK0pwjvZV/BvqreOtH2ATHZT3VgqR/2mld5fOX8qpFXFPxqj LFwKUtYhD98g59Z/FyGc9AuoFJVg667/tOyahxm0= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 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 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) 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 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 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: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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. */