gdb bug on Fedora Core 3?

From: iQ199 (iQ199_at_163.net)
Date: 04/23/05


Date: Sat, 23 Apr 2005 12:33:26 +0800


The code is very easy:

#include <stdio.h>

main()
{
char *str;
int size = 10;
int i;
str = (char*)malloc(size);
for (i = size; i > 1; i--)
str[size - i] = '*';
str[size - 1] = '\0';
printf("str=%s\n", str);
}

I want watch "str[size - i]" in gdb, but it report error:
gcc -g -o test test.c

gdb testgdb test

(gdb) b 10
Breakpoint 1 at 0x80483e0: file test.c, line 10.

(gdb) r
Starting program: /root/tmp/test
Breakpoint 1, main() at test.c:10
10 str[size - i] = '*';

(gdb) watch str[size - i]
Hardware watchpoint 2: str[size - i]

(gdb) n
warning: Could not remove hardware watchpoint 2.
Warning:
Could not insert hardware watchpoint 2.
Could not insert hardware breakpoints:
You may have requested too may hardware breakpoints/watchpoints.

it only report error on Fedora Core 3.
i tseted it on redhat linux 9.0/Fedora Core 1, no error.



Relevant Pages

  • Re: gdb break
    ... Gdb watchpoints work just fine. ... int count; ... Hardware watchpoint 1: *$1 ... incr at t.c:7 ...
    (comp.unix.programmer)
  • Re: arm linux with gdb
    ... > The problem I had with ARM remote GDB is that it assumes ... I found the exact opposite when configuring GDB ... targets support hardware breakpoints and allow the hbreak command to ...
    (comp.os.linux.embedded)
  • Re: How to use "watch" command in gdb?
    ... The reason: 'val' only exists while you are inside main. ... You never issued GDB 'run' command, so it never came to exist. ... Hardware watchpoint 2: val ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.programmer)
  • I dont understand why the compiler does this.
    ... int manip(char *str) { ... Then I run this code on under the gnu debugger 4.18, ... GNU gdb 4.18 ...
    (comp.unix.programmer)
  • I dont understand why the compiler does this.
    ... int manip(char *str) { ... Then I run this code on under the gnu debugger 4.18, ... GNU gdb 4.18 ...
    (comp.unix.programmer)