From: Tom Tromey <tromey@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: lazily call save_current_space_and_thread
Date: Wed, 09 Mar 2011 14:43:00 -0000 [thread overview]
Message-ID: <m3y64oe5mk.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m3bp1limhf.fsf@fleche.redhat.com> (Tom Tromey's message of "Tue, 08 Mar 2011 09:51:56 -0700")
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Tom> This patch makes make_cleanup_restore_current_thread more efficient, by
Tom> having it not compute the current frame when there is no selected frame.
Tom> This approach let me remove another hack I had in my tree.
I am checking in this revised version. I made the changes Jan and Pedro
suggested.
Built and regtested on x86-64 (compile farm).
Tom
2011-03-09 Tom Tromey <tromey@redhat.com>
* thread.c (restore_selected_frame): Handle frame_level == -1.
(make_cleanup_restore_current_thread): Use
get_selected_frame_if_set.
* frame.h (get_selected_frame_if_set): Declare.
* frame.c (get_selected_frame_if_set): New function.
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.291
diff -u -r1.291 frame.c
--- frame.c 7 Jan 2011 19:36:17 -0000 1.291
+++ frame.c 9 Mar 2011 14:21:33 -0000
@@ -1247,6 +1247,14 @@
return selected_frame;
}
+/* If there is a selected frame, return it. Otherwise, return NULL. */
+
+struct frame_info *
+get_selected_frame_if_set (void)
+{
+ return selected_frame;
+}
+
/* This is a variant of get_selected_frame() which can be called when
the inferior does not have a frame; in that case it will return
NULL instead of calling error(). */
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.188
diff -u -r1.188 frame.h
--- frame.h 27 Feb 2011 16:25:37 -0000 1.188
+++ frame.h 9 Mar 2011 14:21:33 -0000
@@ -260,6 +260,9 @@
and then return that thread's previously selected frame. */
extern struct frame_info *get_selected_frame (const char *message);
+/* If there is a selected frame, return it. Otherwise, return NULL. */
+extern struct frame_info *get_selected_frame_if_set (void);
+
/* Select a specific frame. NULL, apparently implies re-select the
inner most frame. */
extern void select_frame (struct frame_info *);
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.136
diff -u -r1.136 thread.c
--- thread.c 21 Feb 2011 23:40:46 -0000 1.136
+++ thread.c 9 Mar 2011 14:21:33 -0000
@@ -1019,6 +1019,13 @@
struct frame_info *frame = NULL;
int count;
+ /* This means there was no selected frame. */
+ if (frame_level == -1)
+ {
+ select_frame (NULL);
+ return;
+ }
+
gdb_assert (frame_level >= 0);
/* Restore by level first, check if the frame id is the same as
@@ -1137,7 +1144,14 @@
&& target_has_registers
&& target_has_stack
&& target_has_memory)
- frame = get_selected_frame (NULL);
+ {
+ /* When processing internal events, there might not be a
+ selected frame. If we naively call get_selected_frame
+ here, then we can end up reading debuginfo for the
+ current frame, but we don't generally need the debuginfo
+ at this point. */
+ frame = get_selected_frame_if_set ();
+ }
else
frame = NULL;
prev parent reply other threads:[~2011-03-09 14:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 19:52 Tom Tromey
2011-03-05 12:52 ` Jan Kratochvil
2011-03-07 19:54 ` Tom Tromey
2011-03-08 17:14 ` Tom Tromey
2011-03-08 17:16 ` Jan Kratochvil
2011-03-08 17:23 ` Pedro Alves
2011-03-08 17:49 ` Tom Tromey
2011-03-08 17:56 ` Pedro Alves
2011-03-08 18:02 ` Tom Tromey
2011-03-08 18:15 ` Pedro Alves
2011-03-08 18:37 ` Pedro Alves
2011-03-08 20:01 ` Tom Tromey
2011-03-08 23:02 ` Pedro Alves
2011-03-10 20:09 ` Tom Tromey
2011-03-08 19:54 ` Tom Tromey
2011-03-08 19:54 ` Pedro Alves
2011-03-09 14:43 ` Tom Tromey [this message]
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=m3y64oe5mk.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.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