public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "asmwarrior at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/12127] gdb with python support still get crash on showing uninitialized local variables
Date: Sun, 24 Nov 2013 07:31:00 -0000	[thread overview]
Message-ID: <bug-12127-4717-GamGtsR7C5@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-12127-4717@http.sourceware.org/bugzilla/>

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

--- Comment #6 from asmwarrior <asmwarrior at gmail dot com> ---
OK, I think the pushed fix in Bug #16196
(https://sourceware.org/bugzilla/show_bug.cgi?id=16196#c2) should also fix this
bug.

Look at the crash report in comment 2, I have such backtrace:

#0  malloc_failure (size=2009291924) at ../../gdb/gdb/utils.c:1049
#1  0x00634f3a in xmalloc (size=2009291924)
    at ../../gdb/gdb/common/common-utils.c:53
#2  0x004e4bc7 in read_string (addr=2293384, len=2009291924, width=1,
    fetchlimit=200, byte_order=BFD_ENDIAN_LITTLE, buffer=0x298f584,
    bytes_read=0x298f588) at ../../gdb/gdb/valprint.c:1804
#3  0x004e66f8 in val_print_string (elttype=0x4bad438, encoding=0x0,
    addr=2293384, len=2009291924, stream=0x2ec2f68, options=0x298f5e4)
    at ../../gdb/gdb/valprint.c:2475
#4  0x0046ecfe in print_string_repr (printer=0x31075f8,
    hint=0x58a91e8 "string", stream=0x2ec2f68, recurse=1, options=0x298f9d4,
    language=0x7ee360 <cplus_language_defn>, gdbarch=0x2ebd520)
    at ../../gdb/gdb/python/py-prettyprint.c:336

The final reason is that xmalloc(size=2009291924) get a two large and random
size value.

My fix in comment 5 try to limit the size in function print_string_repr(),
which is located as 4th frame in the backtrace above.

The fix in Bug #16196 did a better job, because it limit the size in
read_string() function, which is second frame in the backtrace, so it fixed in
a lower level. Many other cases which call read_string() is fixed now.

I just build the current gdb git HEAD, and did some test again, GDB.exe did not
crash on showing un-initialized variables.

So, I personally think this bug is fixed now, what do you guys think?

Thanks.

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


  parent reply	other threads:[~2013-11-24  7:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-16  1:13 [Bug gdb/12127] New: " asmwarrior at gmail dot com
2012-02-07 20:59 ` [Bug python/12127] " tromey at redhat dot com
2012-03-03 14:01 ` asmwarrior at gmail dot com
2012-03-03 14:02 ` asmwarrior at gmail dot com
2012-06-02  6:53 ` xunxun1982 at gmail dot com
2013-05-07  5:08 ` asmwarrior at gmail dot com
2013-05-07  5:09 ` asmwarrior at gmail dot com
2013-05-07  6:01 ` asmwarrior at gmail dot com
2013-05-07  6:16 ` asmwarrior at gmail dot com
2013-11-24  7:31 ` asmwarrior at gmail dot com [this message]
2013-12-19 16:29 ` xdje42 at gmail dot com
2014-02-16 19:43 ` jackie.rosen at hushmail dot com
2014-05-28 19:43 ` schwab at sourceware dot org
2023-12-09 12:55 ` ssbssa at sourceware dot org
2023-12-10  6:11 ` asmwarrior at gmail dot com
2023-12-10 10:16 ` ssbssa at sourceware dot org

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=bug-12127-4717-GamGtsR7C5@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).