bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gdb bug


From: blakwolf
Subject: gdb bug
Date: Tue, 05 Nov 2002 07:40:45 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826

I was testing about stack size, and I tried this

Linux localhost.localdomain 2.2.17-21mdksecure #1 SMP Thu Oct 5 12:52:38 CEST 2000 i686 unknown

gcc -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs
gcc version 2.95.3 19991030 (prerelease)

the gdb version is the standard mdk 7.2


address@hidden varie]# cat stack.c
int main(){
  #define MEGA 1024*1024

  #ifdef ONE
    #define MEMORY 8*MEGA
  #elif defined(TWO)
    #define MEMORY 32*MEGA
  #elif defined(THREE)
    #define MEMORY 128*MEGA
  #elif defined(FOUR)
    #define MEMORY 256*MEGA
  #elif defined(FIVE)
    #define MEMORY 512*MEGA
  #endif

  #ifndef MEMORY
    #define MEMORY MEGA
  #endif

  char p[MEMORY];
  int i;

  for (i = 0; i < MEMORY; ++i)
    p[i] = 0;

  return 0;
}

address@hidden varie]# gcc -ostack -g -Wall -pedantic stack.c -DONE

address@hidden varie]# stack
Segmentation fault (core dumped)

address@hidden varie]# gdb ./stack
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-mandrake-linux"...
(gdb) bra eak main
Breakpoint 1 at 0x80483c9: file stack.c, line 23.
(gdb) run
Starting program: ./stack
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Breakpoint 1, main () at stack.c:23
23        for (i = 0; i < MEMORY; ++i)
(gdb) disp p
Segmentation fault (core dumped)

Cheers

--
#include <stdio.h>/* (C) BW2K+2 This code is released under GPL 2+ */
int main(void){char c[]={98,108,97,107,119,111,108,102,64,116,105,
115,99,97,108,105,46,105,116,32,119,101,98,46,116,105,115,99,97,108,
105,46,105,116,47,98,108,97,107,119,111,108,102,0};printf("%s\n",c);}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]