From: Alan Hayward <Alan.Hayward@arm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: nd <nd@arm.com>, Alan Hayward <Alan.Hayward@arm.com>
Subject: [PATCH v2 3/3] Check arguments for all probes before using them
Date: Wed, 21 Aug 2019 15:58:00 -0000 [thread overview]
Message-ID: <20190821155816.45504-4-alan.hayward@arm.com> (raw)
In-Reply-To: <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)
next prev parent reply other threads:[~2019-08-21 15:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 15:58 [PATCH v2 0/3] Fix stop-on-solib event failures Alan Hayward
2019-08-21 15:58 ` Alan Hayward [this message]
2019-08-21 15:58 ` [PATCH v2 1/3] Refactor svr4_create_solib_event_breakpoints Alan Hayward
2019-08-21 15:58 ` [PATCH v2 2/3] Use gdbarch for probe::get_argument_count Alan Hayward
2019-09-04 17:58 ` Sergio Durigan Junior
2019-09-04 18:00 ` Sergio Durigan Junior
2019-08-30 15:51 ` [PATCH v2 0/3] Fix stop-on-solib event failures Gary Benson
2019-09-02 13:20 ` Alan Hayward
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190821155816.45504-4-alan.hayward@arm.com \
--to=alan.hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=nd@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox