public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/15863] New: -var-update if the program is not running crashes gdb
@ 2013-08-20 16:15 dimitar.zhekov at gmail dot com
  2014-06-16 18:51 ` [Bug mi/15863] " cvs-commit at gcc dot gnu.org
  2014-06-16 18:52 ` keiths at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dimitar.zhekov at gmail dot com @ 2013-08-20 16:15 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 15863
           Summary: -var-update if the program is not running crashes gdb
           Product: gdb
           Version: 7.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mi
          Assignee: unassigned at sourceware dot org
          Reporter: dimitar.zhekov at gmail dot com
              Host: Linux xos4 3.10-2-686-pae #1 SMP Debian 3.10.5-1
                    (2013-08-07) i686 GNU/Linux
            Target: Linux xos4 3.10-2-686-pae #1 SMP Debian 3.10.5-1
                    (2013-08-07) i686 GNU/Linux

Steps to reproduce:

$ gdb --interpreter=mi ~/hello
=thread-group-added,id="i1"
~"Reading symbols from /home/build/hello..."

(gdb) -var-create - * main
^done,name="var1",numchild="0",value="{int (void)} 0x80483fc <main>",type="int
(void)",has_more="0"

(gdb) -data-evaluate-expression main
^done,value="{int (void)} 0x80483fc <main>"

(gdb) -var-update *
~"/build/gdb-CewkFW/gdb-7.6/gdb/thread.c:615: internal-error: is_thread_state:
Assertion `tp' failed.\nA problem internal to GDB has been detected,\nfurther
debugging may prove unreliable.\nQuit this debugging session? "
~"(y or n) "
y
Aborted (core dumped)

--

The program doesn't matter; any C or C++ program compiled with -g will do.

Evaluating main() doesn't make much sense, but it crashes on any global symbol.

Using @ or 0 for stack frame makes no difference.

-var-update works fine _while the program is running_, and crashes again if it
has been terminated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug mi/15863] -var-update if the program is not running crashes gdb
  2013-08-20 16:15 [Bug mi/15863] New: -var-update if the program is not running crashes gdb dimitar.zhekov at gmail dot com
@ 2014-06-16 18:51 ` cvs-commit at gcc dot gnu.org
  2014-06-16 18:52 ` keiths at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-06-16 18:51 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15863

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  6be47f0c48cbd58921a25e7493ca79a6f596dffe (commit)
      from  b97e87cc01703e2e612b1fc21c54f90b1a0f4519 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6be47f0c48cbd58921a25e7493ca79a6f596dffe

commit 6be47f0c48cbd58921a25e7493ca79a6f596dffe
Author: Keith Seitz <keiths@redhat.com>
Date:   Wed Jun 11 13:26:50 2014 -0700

    Fix for PR mi/15863

    If an MI client creates a varobj and attempts to update the root
    /before/ the inferior is started, gdb will throw an internal error:

    (gdb)
    -var-create * - batch_flag
    ^done,name="var1",numchild="0",value="0",type="int",has_more="0"
    (gdb)
    -var-update var1
    ^done,changelist=[]
    (gdb)
    -var-update *
    ~"../../src/gdb/thread.c:628: internal-error: is_thread_state: Assertion
`tp' failed.\nA problem internal to GDB has been detected,\nfurther debugging
may prove unreliable.\nQuit this debugging session? "
    ~"(y or n) "

    The function that handles the varobj update in the failing case,
    mi_cmd_var_udpate_iter, checks if the thread/inferior is stopped before
    attempting to update the varobj. It calls is_stopped (inferior_ptid)
    which calls is_thread_state:

        tp = find_thread_ptid (ptid);
        gdb_assert (tp);

    When there is no inferior, ptid is null_ptid, and find_thread_ptid
(null_ptid)
    returns NULL and the assertion is triggered.

    This patch changes mi_cmd_var_update_iter to behave the same way
    "-var-update var1" does: by calling the thread "stopped" if
    there is no inferior (and thereby calling varobj_update_one).

    ChangeLog
    2014-06-16  Keith Seitz  <keiths@redhat.com>

        PR mi/15863
        * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Do not attempt
        to update the varobj if inferior_ptid is null_ptid.

    testsuite/ChangeLog
    2014-06-16  Keith Seitz  <keiths@redhat.com>

        PR mi/15863
        * gdb.mi/mi-var-cmd.exp: Add test for -var-update before
        the inferior is started.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                       |    6 ++++++
 gdb/mi/mi-cmd-var.c                 |    4 +++-
 gdb/testsuite/ChangeLog             |    6 ++++++
 gdb/testsuite/gdb.mi/mi-var-cmd.exp |    6 ++++++
 4 files changed, 21 insertions(+), 1 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug mi/15863] -var-update if the program is not running crashes gdb
  2013-08-20 16:15 [Bug mi/15863] New: -var-update if the program is not running crashes gdb dimitar.zhekov at gmail dot com
  2014-06-16 18:51 ` [Bug mi/15863] " cvs-commit at gcc dot gnu.org
@ 2014-06-16 18:52 ` keiths at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: keiths at redhat dot com @ 2014-06-16 18:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15863

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |keiths at redhat dot com
         Resolution|---                         |FIXED
           Assignee|unassigned at sourceware dot org   |keiths at redhat dot com
   Target Milestone|---                         |7.8

--- Comment #2 from Keith Seitz <keiths at redhat dot com> ---
Thank you for reporting this. I've committed a patch to fix this. Please let me
know if there are any further problems.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-06-16 18:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-20 16:15 [Bug mi/15863] New: -var-update if the program is not running crashes gdb dimitar.zhekov at gmail dot com
2014-06-16 18:51 ` [Bug mi/15863] " cvs-commit at gcc dot gnu.org
2014-06-16 18:52 ` keiths at redhat 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).