Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: "Jan Kratochvil" <jan.kratochvil@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"Tom Tromey" <tromey@redhat.com>
Subject: Re: Re-evaluate floating varobj as part of varobj_invalidate.
Date: Fri, 27 Jul 2012 08:21:00 -0000	[thread overview]
Message-ID: <50124F42.5060404@broadcom.com> (raw)
In-Reply-To: <20120726083511.GA16614@host2.jankratochvil.net>

On 26/07/2012 9:35 AM, Jan Kratochvil wrote:
> On Wed, 25 Jul 2012 19:52:22 +0200, Tom Tromey wrote:
>>>>>>> "Andrew" == Andrew Burgess <aburgess@broadcom.com> writes:
>>
>> Andrew> I have a bug & patch, but no great way to reproduce the issue as
>> Andrew> it's a use of pointer after free issue,
>>
>> I suspect the recent-ish change to use -lmcheck by default will cause us
>> to catch this bug in the test suite, at least on glibc-using systems.
> 
> Yes, FSF GDB HEAD crashes for me with the posted reproducer.  Could you write
> this simple testcase?

There's a patch below that tests this issue, it does indeed fail for me running on x86-linux before my fix patch, and works afterwards.

If this test is ok I'll commit the fix and the test patches together.

Thanks
Andrew

gdb/testsuite/ChangeLog

2012-07-27  Andrew Burgess  <aburgess@broadcom.com>

       * gdb.mi/mi-var-invalidate.exp: Create a floating variable and
       change its format immediately after reloading the binary.

diff --git a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
index 3ecbbdf..98dd3f1 100644
--- a/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-invalidate.exp
@@ -61,6 +61,9 @@ mi_runto do_locals_tests
 # Desc: create local variables
 mi_create_varobj linteger linteger "create local variable linteger"
 
+# Desc: create floating variable
+mi_create_floating_varobj float_simple array "create floating variable"
+
 #
 # Reload the same binary.
 # Global variable should remain, local should be invalidated.
@@ -69,6 +72,12 @@ mi_delete_breakpoints
 mi_gdb_load ${binfile_bis}
 mi_runto main
 
+# Change format of floating variable immediately after reload reveals a
+# bug where gdb still uses a free'd pointer.
+mi_gdb_test "-var-set-format float_simple hexadecimal" \
+        "\\^done,format=\"hexadecimal\",value=\"\\\[-1\\\]\"" \
+       "set format variable float_simple"
+
 # Check local variable is "invalid".
 mi_gdb_test "-var-update linteger" \
        "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"invalid\",has_more=\"0\"\}\\\]" \



  reply	other threads:[~2012-07-27  8:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 16:59 Andrew Burgess
2012-07-25 17:52 ` Tom Tromey
2012-07-26  8:35   ` Jan Kratochvil
2012-07-27  8:21     ` Andrew Burgess [this message]
2012-07-27 14:06       ` Jan Kratochvil
2012-07-30 12:27         ` Andrew Burgess

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=50124F42.5060404@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=tromey@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