www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - gdb bugs/patches

reply Brad Roberts <braddr puremagic.com> writes:
Who was it that has the appropriate paperwork on file to get patches into gdb?

I've got a small diff that fixes a critical problem with it's demangler:

diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 6db521b..f17431b 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
   -37,8 +37,9    extract_identifiers (const char *mangled_str, struct obstack
*tempbuf)

   while (isdigit (*mangled_str))
     {
-      i = strtol (mangled_str, NULL, 10);
-      mangled_str++;
+      char * end_ptr;
+      i = strtol (mangled_str, &end_ptr, 10);
+      mangled_str = end_ptr;
       if (i <= 0  && strlen (mangled_str) < i)
         return 0;
       obstack_grow (tempbuf, mangled_str, i);

Before this change, symbols with strings over 9 bytes long gets into a bad state
and might end up crashing.  Certainly ends up with a bad string.

And example that crashes for me:
    20src/core/atomic.d.9215__unittest_failFiZv

Thanks,
Brad
Aug 01 2010
parent reply Robert Clipsham <robert octarineparrot.com> writes:
On 01/08/10 10:01, Brad Roberts wrote:
 Who was it that has the appropriate paperwork on file to get patches into gdb?

 I've got a small diff that fixes a critical problem with it's demangler:

 diff --git a/gdb/d-lang.c b/gdb/d-lang.c
 index 6db521b..f17431b 100644
 --- a/gdb/d-lang.c
 +++ b/gdb/d-lang.c
    -37,8 +37,9    extract_identifiers (const char *mangled_str, struct obstack
 *tempbuf)

     while (isdigit (*mangled_str))
       {
 -      i = strtol (mangled_str, NULL, 10);
 -      mangled_str++;
 +      char * end_ptr;
 +      i = strtol (mangled_str,&end_ptr, 10);
 +      mangled_str = end_ptr;
         if (i<= 0&&  strlen (mangled_str)<  i)
           return 0;
         obstack_grow (tempbuf, mangled_str, i);

 Before this change, symbols with strings over 9 bytes long gets into a bad
state
 and might end up crashing.  Certainly ends up with a bad string.

 And example that crashes for me:
      20src/core/atomic.d.9215__unittest_failFiZv

 Thanks,
 Brad
If I recall correctly all you need to do is send a message to the gdb patches mailing list[1] - you shouldn't need to fill in copyright assignment forms for a small patch like this, see http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gdb/CONTRIBUTE?content-type=text/x-cvswe -markup&cvsroot=src for details. [1] http://www.gnu.org/software/gdb/mailing-lists/#gdb-patches -- Robert http://octarineparrot.com/
Aug 01 2010
parent Brad Roberts <braddr puremagic.com> writes:
On 8/1/2010 3:49 AM, Robert Clipsham wrote:
 On 01/08/10 10:01, Brad Roberts wrote:
 Who was it that has the appropriate paperwork on file to get patches into gdb?
<snip>
 Thanks,
 Brad
If I recall correctly all you need to do is send a message to the gdb patches mailing list[1] - you shouldn't need to fill in copyright assignment forms for a small patch like this, see http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/gdb/CONTRIBUTE?content-type=text/x-cvsweb-markup&cvsroot=src for details. [1] http://www.gnu.org/software/gdb/mailing-lists/#gdb-patches
Ok.. re-sent to gdb-patches sourceware.org. Thanks, Brad
Aug 01 2010