public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/15924] New: Segmentation fault on Windows/Mingw with Go python library
@ 2013-09-02 23:40 sirnewton_01 at yahoo dot ca
  2014-02-13 20:44 ` [Bug python/15924] " dje at google dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: sirnewton_01 at yahoo dot ca @ 2013-09-02 23:40 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 15924
           Summary: Segmentation fault on Windows/Mingw with Go python
                    library
           Product: gdb
           Version: 7.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: sirnewton_01 at yahoo dot ca

After compiling gdb 7.6.1 on windows 7 32-bit using MingW (gcc 4.7.2) with
python support (version 2.7, --with-python). A segmentation fault occurs when
trying to use the "info goroutines" command when stopped at a breakpoint.

Attaching another gdb to the original reveals the following stack trace that
leads up to the segmentation fault:

#0  0x0065c9bb in int_vasprintf (result=result@entry=0x2cff174,
    format=<optimized out>,
    format@entry=0x6c4fd0 <__PRETTY_FUNCTION__.19007+2255> "Attempt to extract
a
 component of a value that is not a %s.", args=args@entry=0x2cff21c "")
    at ./vasprintf.c:129
#1  0x0065ca85 in vasprintf (result=result@entry=0x2cff174,
    format=format@entry=0x6c4fd0 <__PRETTY_FUNCTION__.19007+2255> "Attempt to
ex
tract a component of a value that is not a %s.",
    args=args@entry=0x2cff21c "") at ./vasprintf.c:160
#2  0x005c72cb in xstrvprintf (
    format=format@entry=0x6c4fd0 <__PRETTY_FUNCTION__.19007+2255> "Attempt to
ex
tract a component of a value that is not a %s.", ap=ap@entry=0x2cff21c "")
    at ./common/common-utils.c:130
#3  0x004ef6fc in throw_it (reason=reason@entry=RETURN_ERROR,
    error=error@entry=GENERIC_ERROR,
    fmt=fmt@entry=0x6c4fd0 <__PRETTY_FUNCTION__.19007+2255> "Attempt to extract
a component of a value that is not a %s.", ap=ap@entry=0x2cff21c "")
    at exceptions.c:400
#4  0x004efa63 in throw_verror (error=error@entry=GENERIC_ERROR,
    fmt=fmt@entry=0x6c4fd0 <__PRETTY_FUNCTION__.19007+2255> "Attempt to extract
a component of a value that is not a %s.", ap=ap@entry=0x2cff21c "")
    at exceptions.c:429
#5  0x005a094f in error (
    string=0x6c4fd0 <__PRETTY_FUNCTION__.19007+2255> "Attempt to extract a
compo
nent of a value that is not a %s.") at utils.c:717
#6  0x004b3715 in value_struct_elt (argp=argp@entry=0x2cff278,
    args=args@entry=0x0, name=name@entry=0x61a9968 "tab",
    static_memfuncp=static_memfuncp@entry=0x0, err=err@entry=0x0)
    at valops.c:2361
#7  0x00460bfd in valpy_getitem (self=0x456c440, key=0x45d66e0)
    at ./python/py-value.c:532
#8  0x1e07c54e in python27!PyObject_GetItem ()
   from C:\Windows\system32\python27.dll
#9  0x045d66e0 in ?? ()
#10 0x00000000 in ?? ()

The problem is in the value_struct_elt() where it sometimes has an err that is
NULL and uses err for a formatted string without checking whether it can be
NULL. A simple fix is to guard against the null like this:

  if (TYPE_CODE (t) != TYPE_CODE_STRUCT
      && TYPE_CODE (t) != TYPE_CODE_UNION) {
      if (err != NULL) {
    error (_("Attempt to extract a component of a value that is not a %s."),
       err);
        } else {
        error (_("Attempt to extract a component of a value that is not a
<NULL>.")
       );
    }

This fix appears solve my problem. The Go language runtime support script is
successfully loaded.

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


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

* [Bug python/15924] Segmentation fault on Windows/Mingw with Go python library
  2013-09-02 23:40 [Bug python/15924] New: Segmentation fault on Windows/Mingw with Go python library sirnewton_01 at yahoo dot ca
@ 2014-02-13 20:44 ` dje at google dot com
  2022-12-01 21:50 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dje at google dot com @ 2014-02-13 20:44 UTC (permalink / raw)
  To: gdb-prs

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

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at google dot com

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


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

* [Bug python/15924] Segmentation fault on Windows/Mingw with Go python library
  2013-09-02 23:40 [Bug python/15924] New: Segmentation fault on Windows/Mingw with Go python library sirnewton_01 at yahoo dot ca
  2014-02-13 20:44 ` [Bug python/15924] " dje at google dot com
@ 2022-12-01 21:50 ` tromey at sourceware dot org
  2022-12-01 21:54 ` tromey at sourceware dot org
  2022-12-06 15:18 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-12-01 21:50 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
I suspect we have a generic problem where printf with %s and null
can crash on some systems.  If you track through the printf code,
at the very bottom we call vsprintf -- from the platform.
I'd have to check if we're using gnulib for this.
If not we should probably substitute "(null)" for a null
pointer in ui_out::vmessage.
Also maybe the callers of value_struct_elt should be audited.

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

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

* [Bug python/15924] Segmentation fault on Windows/Mingw with Go python library
  2013-09-02 23:40 [Bug python/15924] New: Segmentation fault on Windows/Mingw with Go python library sirnewton_01 at yahoo dot ca
  2014-02-13 20:44 ` [Bug python/15924] " dje at google dot com
  2022-12-01 21:50 ` tromey at sourceware dot org
@ 2022-12-01 21:54 ` tromey at sourceware dot org
  2022-12-06 15:18 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-12-01 21:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Looks like the value_struct_elt call was fixed;

commit 5996220cfa24ef6fddb782617720cd56913b1bb7
Author: Doug Evans <dje@google.com>
Date:   Mon Nov 7 13:31:24 2016 -0800

    Fix ext lang calls to value_struct_elt.

    gdb/ChangeLog:

            * guile/scm-value.c (gdbscm_value_field): Fix call to
value_struct_elt.
            * python/py-value.c (valpy_getitem): Ditto.

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

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

* [Bug python/15924] Segmentation fault on Windows/Mingw with Go python library
  2013-09-02 23:40 [Bug python/15924] New: Segmentation fault on Windows/Mingw with Go python library sirnewton_01 at yahoo dot ca
                   ` (2 preceding siblings ...)
  2022-12-01 21:54 ` tromey at sourceware dot org
@ 2022-12-06 15:18 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-12-06 15:18 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Fixing ui_out::vmessage would only fix a subset of the calls.
Plenty just go via the platform, e.g., string_printf.
gnulib doesn't seem to fix this problem, even if gdb did
import the gnulib printf.
On the whole I think we're just exposed to this issue as
a generic C problem and so I'm going to close this bug.
Note that the main problem here has been fixed.

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

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

end of thread, other threads:[~2022-12-06 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-02 23:40 [Bug python/15924] New: Segmentation fault on Windows/Mingw with Go python library sirnewton_01 at yahoo dot ca
2014-02-13 20:44 ` [Bug python/15924] " dje at google dot com
2022-12-01 21:50 ` tromey at sourceware dot org
2022-12-01 21:54 ` tromey at sourceware dot org
2022-12-06 15:18 ` tromey at sourceware dot org

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).