* gdb watch command on ppc
@ 2005-10-12 21:14 Claudia Salzberg
2005-10-12 21:20 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Claudia Salzberg @ 2005-10-12 21:14 UTC (permalink / raw)
To: gdb
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);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gdb watch command on ppc
2005-10-12 21:14 gdb watch command on ppc Claudia Salzberg
@ 2005-10-12 21:20 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2005-10-12 21:20 UTC (permalink / raw)
To: Claudia Salzberg; +Cc: gdb
On Wed, Oct 12, 2005 at 04:16:07PM -0500, Claudia Salzberg wrote:
> 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.
First of all, GDB doesn't support HW watchpoints for PPC at the moment;
are you using Manoj's patches? At least I don't think it does.
> Breakpoint 1, main () at main.c:13
> 13 int *a = (int *)malloc(sizeof(int));
> (gdb) watch a
> Watchpoint 2: a
If it did, this would say "Hardware Watchpoint"; you're getting
single-step watchpoints.
> (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
This may be a backtrace bug. GDB thinks that main() has returned,
because it failed to backtrace out of the dynamic linker in the call to
malloc().
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-10-12 21:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-12 21:14 gdb watch command on ppc Claudia Salzberg
2005-10-12 21:20 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).