[RFA,1/3] Clear frame cache when loading or unloading a JIT unwinder

Message ID 1465612923-24880-2-git-send-email-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey June 11, 2016, 2:42 a.m. UTC
  It seemed to me that gdb should flush the frame cache when loading or
unloading a JIT unwinder.  This makes testing a JIT unwinder a bit
simpler.

jit-reader-load apparently has no tests in-tree, so I didn't add a new
test here.

2016-06-09  Tom Tromey  <tom@tromey.com>

	* jit.c (jit_reader_load_command, jit_reader_unload_command): Call
	reinit_frame_cache.
---
 gdb/ChangeLog | 5 +++++
 gdb/jit.c     | 2 ++
 2 files changed, 7 insertions(+)
  

Comments

Pedro Alves June 17, 2016, 7 p.m. UTC | #1
On 06/11/2016 03:42 AM, Tom Tromey wrote:
> It seemed to me that gdb should flush the frame cache when loading or
> unloading a JIT unwinder.  This makes testing a JIT unwinder a bit
> simpler.
> 
> jit-reader-load apparently has no tests in-tree, so I didn't add a new
> test here.

Yeah.  Tests existed, but had never been pushed in the tree...  I fixed
that now:

  https://sourceware.org/ml/gdb-patches/2016-06/msg00308.html

Could you see if it's easy to extend the test to cover this?

Thanks,
Pedro Alves
  
Tom Tromey June 24, 2016, 2:39 a.m. UTC | #2
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Tom> jit-reader-load apparently has no tests in-tree, so I didn't add a new
Tom> test here.

Pedro> Yeah.  Tests existed, but had never been pushed in the tree...  I fixed
Pedro> that now:
Pedro>   https://sourceware.org/ml/gdb-patches/2016-06/msg00308.html
Pedro> Could you see if it's easy to extend the test to cover this?

I looked and I didn't see a straightforward way.

The basic problem is that flushing the frame cache doesn't affect the
results in the jit-reader.exp test.  In this test, the test case can be
unwound without assistance; JIT reader in question supplies some
symbols.  Clearing the frame cache doesn't affect this.

FWIW I don't care all that much about this patch.  It seemed like an
oversight to me, but I'm more concerned with getting the Python case
right, since in the end that's the sort of unwinder I wrote.

Tom
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 335476b..04609c0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2016-06-09  Tom Tromey  <tom@tromey.com>
+
+	* jit.c (jit_reader_load_command, jit_reader_unload_command): Call
+	reinit_frame_cache.
+
 2016-06-10  Tom Tromey  <tom@tromey.com>
 
 	* gdbtypes.c (arch_type, arch_integer_type, arch_character_type)
diff --git a/gdb/jit.c b/gdb/jit.c
index 9fd5ae6..9bb2da5 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -218,6 +218,7 @@  jit_reader_load_command (char *args, int from_tty)
   prev_cleanup = make_cleanup (xfree, so_name);
 
   loaded_jit_reader = jit_reader_load (so_name);
+  reinit_frame_cache ();
   do_cleanups (prev_cleanup);
 }
 
@@ -234,6 +235,7 @@  jit_reader_unload_command (char *args, int from_tty)
   gdb_dlclose (loaded_jit_reader->handle);
   xfree (loaded_jit_reader);
   loaded_jit_reader = NULL;
+  reinit_frame_cache ();
 }
 
 /* Per-program space structure recording which objfile has the JIT