Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: Pedro Alves <pedro@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [patch] Fix a crash on NULL event_thread
Date: Wed, 17 Sep 2008 21:56:00 -0000	[thread overview]
Message-ID: <20080917215332.GA25808@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20080917180337.GA10202@caradoc.them.org>

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

On Wed, 17 Sep 2008 20:03:37 +0200, Daniel Jacobowitz wrote:
> Please move the reinit_frame_cache call so it is still right after
> adjust_pc_after_break.

I expect the only possible user is tui_selected_frame_level_changed_hook
through DEPRECATED_SELECTED_FRAME_LEVEL_CHANGED_HOOK, thanks for catching it.


> Also, no need to capitalize adjust_pc_after_break; this is like the texinfo
> @var{} markup.  You capitalize FOO when you mean "the value of a variable
> named foo", but the name of the variable is still "foo".

Thanks, I though it has different rules.


> Otherwise looks OK, thanks.

Committed the attached patch (added there two dependency comments).


Regards,
Jan

[-- Attachment #2: ecs4-cvs.patch --]
[-- Type: text/plain, Size: 2017 bytes --]

2008-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix a crash on uninitialized ECS->EVENT_THREAD for a newly found thread.
	* infrun.c (wait_for_inferior): Move this ECS->EVENT_THREAD
	initialization ...
	(fetch_inferior_event): ... and this ECS->EVENT_THREAD initialization
	...
	(handle_inferior_event): ... here after the add_thread call together
	with the local adjust_pc_after_break and reinit_frame_cache calls.

===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.318
retrieving revision 1.319
diff -u -r1.318 -r1.319
--- src/gdb/infrun.c	2008/09/11 14:21:49	1.318
+++ src/gdb/infrun.c	2008/09/17 21:48:49	1.319
@@ -1568,8 +1568,6 @@
       else
 	ecs->ptid = target_wait (waiton_ptid, &ecs->ws);
 
-      ecs->event_thread = find_thread_pid (ecs->ptid);
-
       if (treat_exec_as_sigtrap && ecs->ws.kind == TARGET_WAITKIND_EXECD)
         {
           xfree (ecs->ws.value.execd_pathname);
@@ -1645,8 +1643,6 @@
        thread.  */
     context_switch (ecs->ptid);
 
-  ecs->event_thread = find_thread_pid (ecs->ptid);
-
   /* Now figure out what to do with the result of the result.  */
   handle_inferior_event (ecs);
 
@@ -1854,10 +1850,6 @@
   /* Always clear state belonging to the previous time we stopped.  */
   stop_stack_dummy = 0;
 
-  adjust_pc_after_break (ecs);
-
-  reinit_frame_cache ();
-
   /* If it's a new process, add it to the thread database */
 
   ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid)
@@ -1868,6 +1860,14 @@
       && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event)
     add_thread (ecs->ptid);
 
+  ecs->event_thread = find_thread_pid (ecs->ptid);
+
+  /* Dependent on valid ECS->EVENT_THREAD.  */
+  adjust_pc_after_break (ecs);
+
+  /* Dependent on the current PC value modified by adjust_pc_after_break.  */
+  reinit_frame_cache ();
+
   if (ecs->ws.kind != TARGET_WAITKIND_IGNORE)
     {
       /* Mark the non-executing threads accordingly.  */

      reply	other threads:[~2008-09-17 21:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12 22:17 Jan Kratochvil
2008-09-12 22:45 ` Pedro Alves
2008-09-15 18:59   ` Jan Kratochvil
2008-09-17 15:55     ` Pedro Alves
2008-09-17 18:04 ` Daniel Jacobowitz
2008-09-17 21:56   ` Jan Kratochvil [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=20080917215332.GA25808@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.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