This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/15924] New: Segmentation fault on Windows/Mingw with Go python library


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]