This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 3/3] Check arguments for all probes before using them
- From: Alan Hayward <Alan dot Hayward at arm dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: nd <nd at arm dot com>, Alan Hayward <Alan dot Hayward at arm dot com>
- Date: Wed, 21 Aug 2019 15:58:22 +0000
- Subject: [PATCH v2 3/3] Check arguments for all probes before using them
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2CciE2IMURxHV0UFa3QZMRKekm/C2CxN2zm4BdR1prM=; b=IgMOZbExFQiov7X3UfO2Mpv8dnVrQsNHCNQ9kf63dDB2qbv4n7FHDcOwCB2jydzrTCWgQaSe4KFpzBggUVGq4IRcGGAt4e7YsMlm0YbEyot0ch2kI02HZZ4qrQKwK8esOPQjYfCf980qvAGnQZaHTcn8nw1Slc0pfAKH17J4Ggi8qMpmaIrhkaOBB3yTLbGIAAc+faEx0bq5KUN5/225KYTZcRJaHS/rxnIOo9o6ZfVVd2t169B/uOz7hd2T+EYLFrN2Bx1V8wy057HzjJKDwdVhTRTH6jFu3BaQjmwnYI7QTeqT8FzwpMuZXeLYmpmRe/+Ip3W3TtTKd2/vDL4aCA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VDHBZ7OaEppIjzx7EJVBHm+n6Il89C3f4geC+gJO2Vt/0TrOB03wog2SHiQYnzpSPt13hb787+xen9LC3Os0JmnP2XMES4QZH2HR/XjGyMwKJ+bnQEeiRnajsW0F+59gF4ycfnHDpmQNnOS01xyXKJ8Z4ID/bCQUZz4280WeuJV+QQieCBr8yVH/sznoALqmXgEyB+xFPN9R+/eHjqzPaMrBvqgD10kiEt5KCxu9PLi/2v5pS1WEFcSHUvqDfw7cgIWNXK26S/I/XgEl6lGnZJ6i7c0eFlFwNNumg2K0bBVLpWs5Lz5ClvcGQrJLo5L64OuT60lB28nDfEr/xBJ5Bw==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan dot Hayward at arm dot com;
- References: <20190821155816.45504-1-alan.hayward@arm.com>
There is a long standing bug in the Arm toolchain where invalid
stap probes get created due to the probes referring to symbols which
have been resolved away.
More details are here:
https://bugzilla.redhat.com/show_bug.cgi?id=1196181
When these invalid probes are present, GDB will create the breakpoints
and then fail to stop. The errors are only spotted the first time
GDB stops, which is too late.
The solution is to ensure the arguments for all the probes are
resolved before using them.
This fixes >100 timeouts when running break-interp.exp when using
bad probes.
gdb/ChangeLog:
2019-08-21 Alan Hayward <alan.hayward@arm.com>
* solib-svr4.c (svr4_find_and_create_probe_breakpoints): Check all
probe arguments.
---
gdb/solib-svr4.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 2a44dd6985..ffae26bfc5 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -2071,7 +2071,6 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info,
bool with_prefix)
{
std::vector<probe *> probes[NUM_PROBES];
- bool checked_can_use_probe_arguments = false;
for (int i = 0; i < NUM_PROBES; i++)
{
@@ -2102,12 +2101,23 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info,
return false;
/* Ensure probe arguments can be evaluated. */
- if (!checked_can_use_probe_arguments)
+ for (probe *p : probes[i])
{
- probe *p = probes[i][0];
if (!p->can_evaluate_arguments ())
return false;
- checked_can_use_probe_arguments = true;
+ /* This will fail if the probe is invalid. This has been seen on Arm
+ due to references to symbols that have been resolved away. */
+ try
+ {
+ p->get_argument_count (gdbarch);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ exception_print (gdb_stderr, ex);
+ warning (_("Initializing probes-based dynamic linker interface "
+ "failed.\nReverting to original interface."));
+ return false;
+ }
}
}
--
2.20.1 (Apple Git-117)