You are not logged in.

#1 2013-11-25 13:07:08

masala
Member
Registered: 2013-11-25
Posts: 10

[Solved] gdb "No Stack"

Hello everyone,

I have a freshly installed Arch Linux on my computer that I use for development. So I need the gdb, which is installed.
However, if I try to backtrace a segfault, or some similar problem, I always get only the message "No Stack".
I have compiled the program with g++ and the -g parameter, but even simply test programs won't work:

#include <iostream>
#include <vector>

int main() {
    int *pts = 0;
    pts[10] = 42;
    return 0;
}

Edit: I have the additional problem that when I set for example a breakpoint in KDevelop, the debugger just ignores it and does not stop the execution at this point.

Last edited by masala (2013-11-27 18:48:26)

Offline

#2 2013-11-25 13:57:08

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [Solved] gdb "No Stack"

I'm not sure what's wrong... sad I only have access to a Red Hat machin at the moment, so I did a quick test:

I put your code into "stack.cpp", compiled it using "g++ -g -o stack stack.cpp", and ran it using "gdb stack" (followed by the "run" command). gdb correctly reported that a segmentation fault happened on line 6.

Did you forget to use the "run" command in gdb?

Offline

#3 2013-11-25 14:20:02

masala
Member
Registered: 2013-11-25
Posts: 10

Re: [Solved] gdb "No Stack"

No, unfortunately not. Attached you see, how my gdb session looks like:

$ gdb ./a.out 
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/.../Desktop/a.out...done.
(gdb) run
Starting program: /home/.../Desktop/./a.out 
During startup program terminated with signal SIGSEGV, Segmentation fault.
(gdb) bt
No stack.
(gdb) 

Offline

#4 2013-11-25 19:15:44

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [Solved] gdb "No Stack"

I'm surprised that the program isn't even starting! ("During startup program terminated with signal SIGSEGV") According to the Wikipedia, "a signal called SIGSEGV is sent to a process that accesses an invalid memory address", which makes sense...

Do you have any sort of special configuration to your operating system, such as a the kernel, kernel modules, or compiler settings? Anything that you think might not be considered "normal" in Arch Linux?

Anyway, I'll try out your example when I get home to my Arch Linux computer. EDIT: As Allan confirmed below, trying it on my Arch Linux computer also worked for me.

Last edited by drcouzelis (2013-11-26 01:08:20)

Offline

#5 2013-11-25 21:57:29

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,668
Website

Re: [Solved] gdb "No Stack"

Works for me.   Are you using nvidia?

Offline

#6 2013-11-26 07:07:44

masala
Member
Registered: 2013-11-25
Posts: 10

Re: [Solved] gdb "No Stack"

I have no special configuration. For the installation I followed the instructions in the wiki.
@Allan: Yes, I have a nvidia graphics card. Therefore I installed the nvidia drivers and also cuda.

Last edited by masala (2013-11-26 09:49:08)

Offline

#7 2013-11-27 11:17:21

heinrich5991
Member
Registered: 2012-10-01
Posts: 13

Re: [Solved] gdb "No Stack"

I got a similar issue, maybe this is a bug with a recent gdb/gcc?

int main(int argc, char **argv)
{
	int *p = 0;
	return *p;
}
$ gdb ./a.out 
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/.../a.out...(no debugging symbols found)...done.
(gdb) r
Starting program: /home/..././a.out 
During startup program terminated with signal SIGSEGV, Segmentation fault.
(gdb) quit

EDIT: Some relevant versions:

$ pacman -Q gcc-multilib gdb
gcc-multilib 4.8.2-4
gdb 7.6.1-1

Last edited by heinrich5991 (2013-11-27 11:20:54)

Offline

#8 2013-11-27 12:08:11

masala
Member
Registered: 2013-11-25
Posts: 10

Re: [Solved] gdb "No Stack"

I have the same gdb version (yfi).

Offline

#9 2013-11-27 12:11:04

masala
Member
Registered: 2013-11-25
Posts: 10

Re: [Solved] gdb "No Stack"

UPDATE: I made an update with pacman -Syu which contained the new package linux-3.12.1-3 and now it works.

Offline

#10 2013-11-27 14:26:11

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [Solved] gdb "No Stack"

Great! You probably also had to reboot to make the new kernel take effect, right?

Anyway, you can mark the thread as "[SOLVED]" by "Edit"ing your original post. smile

Offline

#11 2013-12-19 18:44:01

jpab
Member
Registered: 2012-06-12
Posts: 2

Re: [Solved] gdb "No Stack"

I'm seeing the same problem, with an up-to-date system.

test.c:

#include <stdio.h>
#include <assert.h>

int main(void) {
  printf("Hello, world!\n");
  assert(0);
  return 0;
}

Built with:

gcc -std=c89 -Wall -Wextra -O0 -g -o check test.c

The problem is intermittent: sometimes gdb catches the signal and gives me a stack-trace as normal, sometimes it just gives me "During startup program terminated with signal SIGABRT, Aborted.". In either case, the test program prints its message and the normal assertion failure message ("test.c:7: main: Assertion `0' failed.").

Package versions:

$ pacman -Q linux glibc nvidia gcc gdb
linux 3.12.5-1
glibc 2.18-11
nvidia 331.20-2
gcc 4.8.2-6
gdb 7.6.2-1

Offline

Board footer

Powered by FluxBB