GDB segfaults on Pandaboard?

This forum is for supported devices using an ARMv7 Texas Instruments (TI) SoC.

GDB segfaults on Pandaboard?

Postby jpf » Tue Sep 20, 2011 11:00 am

As said in the title I can't get GDB to work on the pandaboard (A3). Even calling gdb without arguments or only with --help causes a segfault. I use a up to date archlinuxARM system and tried the gdb from the repositories, recompiled the gdb package myself and compiled a gdb 7.2 package, all segfault.

Is this a known issue and is there anything that can be done about that?
jpf
 
Posts: 2
Joined: Sun Sep 18, 2011 3:21 pm

Re: GDB segfaults on Pandaboard?

Postby pepedog » Tue Sep 20, 2011 11:23 am

Mine seems ok (trimslice)
# gdb
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv7l-unknown-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: GDB segfaults on Pandaboard?

Postby jpf » Thu Sep 22, 2011 3:13 pm

OK, using some printf debugging, I found the issue and it's not Pandaboard specific at all:
in arm-linux-nat.c there's a get_linux_version function. This function naively assumes that a linux kernel version number always has three parts, but 3.0-ARCH only has two! So the third part is null and strtoul crashes. Kinda stupid bug, I wonder why nobody else hit that till now. Will search the GDB bugtracker now if it's already been filed.

Patch:
$this->bbcode_second_pass_code('', 'diff -ur gdb-7.3.1/gdb/arm-linux-nat.c gdb-7.3.1.patched/gdb/arm-linux-nat.c
--- gdb-7.3.1/gdb/arm-linux-nat.c 2011-02-21 09:03:37.000000000 -0600
+++ gdb-7.3.1.patched/gdb/arm-linux-nat.c 2011-09-22 09:50:22.000000000 -0500
@@ -674,9 +674,15 @@
pminor = strtok (NULL, ".");
prelease = strtok (NULL, ".");

- *vmajor = (unsigned int) strtoul (pmajor, &tail, 0);
- *vminor = (unsigned int) strtoul (pminor, &tail, 0);
- *vrelease = (unsigned int) strtoul (prelease, &tail, 0);
+ *vmajor = 0;
+ *vminor = 0;
+ *vrelease = 0;
+ if(pmajor)
+ *vmajor = (unsigned int) strtoul (pmajor, &tail, 0);
+ if(pminor)
+ *vminor = (unsigned int) strtoul (pminor, &tail, 0);
+ if(prelease)
+ *vrelease = (unsigned int) strtoul (prelease, &tail, 0);

return ((*vmajor << 16) | (*vminor << 8) | *vrelease);
}
')

BUG: http://sourceware.org/bugzilla/show_bug.cgi?id=13218
jpf
 
Posts: 2
Joined: Sun Sep 18, 2011 3:21 pm


Return to Texas Instruments (TI)

Who is online

Users browsing this forum: No registered users and 16 guests