From: Mihails Strasuns via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] gdb: get jiter objfile from a bound minsym
Date: Wed, 14 Oct 2020 11:00:03 +0200 [thread overview]
Message-ID: <20201014090003.17736-1-mihails.strasuns@intel.com> (raw)
This fixes a regression introduced by the following commit:
fe053b9e853 gdb/jit: pass the jiter objfile as an argument to jit_event_handler
In the refactoring `handle_jit_event` function was changed to pass a matching
objfile pointer to the `jit_event_handler` explicitly, rather using internal
storage:
```
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5448,8 +5448,9 @@ handle_jit_event (void)
frame = get_current_frame ();
gdbarch = get_frame_arch (frame);
+ objfile *jiter = symbol_objfile (get_frame_function (frame));
- jit_event_handler (gdbarch);
+ jit_event_handler (gdbarch, jiter);
```
This was needed to add support for a multiple jiters in a following commits.
However it has also introduced a regression, because `get_frame_function
(frame)` here may return `nullptr`, resulting in a crash.
A more resilient way would be to use an approach mirroring
`jit_breakpoint_re_set` - to find a minimal symbol matching the breakpoint
location and use its object file. We know that this breakpoint events comes
from a breakpoint set by `jit_breakpoint_re_set`, thus using the reverse
approach should be reliable enough.
gdb/Changelog:
2020-10-14 Mihails Strasuns <mihails.strasuns@intel.com>
* breakpoint.c (handle_jit_event): and an argument, change how
`jit_event_handler` is called.
---
gdb/breakpoint.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 414208469f9..878d48c5984 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5434,9 +5434,8 @@ bpstat_stop_status (const address_space *aspace,
}
static void
-handle_jit_event (void)
+handle_jit_event (CORE_ADDR address)
{
- struct frame_info *frame;
struct gdbarch *gdbarch;
if (debug_infrun)
@@ -5446,11 +5445,9 @@ handle_jit_event (void)
breakpoint_re_set. */
target_terminal::ours_for_output ();
- frame = get_current_frame ();
- gdbarch = get_frame_arch (frame);
- objfile *jiter = symbol_objfile (get_frame_function (frame));
-
- jit_event_handler (gdbarch, jiter);
+ gdbarch = get_frame_arch (get_current_frame ());
+ bound_minimal_symbol jit_bp_sym = lookup_minimal_symbol_by_pc (address);
+ jit_event_handler (gdbarch, jit_bp_sym.objfile);
target_terminal::inferior ();
}
@@ -5651,7 +5648,7 @@ bpstat_run_callbacks (bpstat bs_head)
switch (b->type)
{
case bp_jit_event:
- handle_jit_event ();
+ handle_jit_event (bs->bp_location_at->address);
break;
case bp_gnu_ifunc_resolver:
gnu_ifunc_resolver_stop (b);
--
2.17.1
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next reply other threads:[~2020-10-14 8:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 9:00 Mihails Strasuns via Gdb-patches [this message]
2020-10-14 9:01 ` Strasuns, Mihails via Gdb-patches
2020-10-19 9:49 ` Andrew Burgess
2020-10-19 10:39 ` Aktemur, Tankut Baris via Gdb-patches
2020-10-19 14:58 ` Strasuns, Mihails via Gdb-patches
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=20201014090003.17736-1-mihails.strasuns@intel.com \
--to=gdb-patches@sourceware.org \
--cc=mihails.strasuns@intel.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