This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb watch command on ppc


Greetings,

I have noticed a discrepancy between the way the gdb for ppc handles 
watchpoints on pointers.  I am trying to place a software watchpoint on a 
variable of type int * and am not getting the expected results.  Note that 
I observe the expected functionality (the watchpoint being correctly set) 
on x86 and that I have tried the following on today's cvs head.  I have 
also tried this on various ppc machines with the same result.  I include 
the sample program that matches the output shown below as well as an 
additional program that generates the same behavior.  I do not see this if 
I attempt to place a watchpoint on a non pointer variable.  Thanks for 
your input.

-Claudia Salzberg

##############################################
#####The output of the gdb session is as follows:#####
##############################################
linux:~ # ./gdbhead pointertest
GNU gdb 6.3.50.20051012-cvs
Copyright 2004 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 "ppc-linux"...Using host libthread_db library 
"/lib/.

(gdb) dir /root
Source directories searched: /root:$cdir:$cwd
(gdb) b main
Breakpoint 1 at 0x100004c8: file main.c, line 13.
(gdb) r
Starting program: /root/pointertest

Breakpoint 1, main () at main.c:13
13              int *a = (int *)malloc(sizeof(int));
(gdb) watch a
Watchpoint 2: a
(gdb) c
Continuing.

Watchpoint 2 deleted because the program has left the block in
which its expression is valid.
fixup (l=0x7ffff620, reloc_offset=0) at dl-runtime.c:63
63      dl-runtime.c: No such file or directory.
        in dl-runtime.c
(gdb) c
Continuing.
Done

Program exited with code 01.
(gdb)

##################################
#####The source for pointertest is:#####
##################################
int writedata(int *x)
{
        *x = 105;
        return 1;
}
int main()
{
        int *a = (int *)malloc(sizeof(int));
        writedata(a);
        free(a);
        a = NULL;
        printf("Done\n");
        return 1;
}

###########################
#####An additional test is:#####
###########################
main()
{
        int *a;
        int i=0;
        for (i=0; i < 10; i++)
        { 
                a = (int *)malloc(sizeof(int));
                free(a);
        }
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]