public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug remote/12228] New: thread.c:598: internal-error: is_thread_state: Assertion `tp' failed.
@ 2010-11-18 15:40 jon at beniston dot com
  2011-03-25 15:26 ` [Bug remote/12228] " aburgess at broadcom dot com
  0 siblings, 1 reply; 2+ messages in thread
From: jon at beniston dot com @ 2010-11-18 15:40 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12228

           Summary: thread.c:598: internal-error: is_thread_state:
                    Assertion `tp' failed.
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: remote
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jon@beniston.com


When debugging an extended-remote target that automatically restarts after
exiting, GDB will abort with:

thread.c:598: internal-error: is_thread_state: Assertion `tp' failed. 

when the thread exits. This appears to be due to the code in
remote.c:extended_remote_mourn_1()

The code is:

          /* Assume that the target has been restarted.  Set inferior_ptid
         so that bits of core GDB realizes there's something here, e.g.,
         so that the user can say "kill" again.     */
          inferior_ptid = magic_null_ptid;  

The problem is that this code sets a ptid, but thread_list is null (presumably
because the thread has been removed due to it exiting), so when
is_thread_state() is called at some later time, it looks for the
magic_null_ptid thread in thread_list, but it can't find it, which results in
the assertion failure.

One possiblity to fix this would be to create a thread, by adding the following
after the code above:

              inferior_ptid = remote_current_thread (inferior_ptid);            
              remote_add_inferior (ptid_get_pid (inferior_ptid), -1);
              add_thread_silent (inferior_ptid);

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug remote/12228] thread.c:598: internal-error: is_thread_state: Assertion `tp' failed.
  2010-11-18 15:40 [Bug remote/12228] New: thread.c:598: internal-error: is_thread_state: Assertion `tp' failed jon at beniston dot com
@ 2011-03-25 15:26 ` aburgess at broadcom dot com
  0 siblings, 0 replies; 2+ messages in thread
From: aburgess at broadcom dot com @ 2011-03-25 15:26 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12228

Andrew Burgess <aburgess at broadcom dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aburgess at broadcom dot
                   |                            |com

--- Comment #1 from Andrew Burgess <aburgess at broadcom dot com> 2011-03-25 15:25:55 UTC ---
There are further problems that the previous patch doesn't fix, if after
killing the remote target that then restarts you might be tempted to try "info
program" or "info threads" both of these will run into similar problems.

The patch below uses the remote_start_remote method in the same way as when we
initially connect to the target to setup the thread state.

diff -u -p -r1.10 -r1.11
--- ./binutils/gdb/remote.c    27 Oct 2010 16:33:30 -0000    1.10
+++ ./binutils/gdb/remote.c    25 Mar 2011 15:13:01 -0000    1.11
@@ -6674,10 +6674,25 @@ extended_remote_mourn_1 (struct target_o

       if (rs->buf[0] == 'S' || rs->buf[0] == 'T')
         {
-          /* Assume that the target has been restarted.  Set inferior_ptid
-         so that bits of core GDB realizes there's something here, e.g.,
-         so that the user can say "kill" again.     */
-          inferior_ptid = magic_null_ptid;
+              /* APB: 25-March-2010: Fix for issue TLFIREPATH-2263.
+                 When we kill the remote target the target is actual
+                 reset, and then enters the stop state, just like
+                 when we originally connect to it - we want the
+                 threads to reflect that.  */
+              struct gdb_exception ex;
+              struct start_remote_args args;
+              
+              args.from_tty = 0;
+              args.target = target;
+              args.extended_p = 1;
+
+              printf_filtered (_("Remote target reset.\n"));
+
+          /* Assume that the target has been restarted. Attempt to
+                 restart the target.  */
+              ex = catch_exception (uiout, remote_start_remote, &args,
RETURN_MASK_ALL);
+              if (ex.reason < 0)
+                throw_exception (ex);
         }
     }
     }

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-25 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18 15:40 [Bug remote/12228] New: thread.c:598: internal-error: is_thread_state: Assertion `tp' failed jon at beniston dot com
2011-03-25 15:26 ` [Bug remote/12228] " aburgess at broadcom dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).