public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Claudia Salzberg <salzberg@us.ibm.com>
To: gdb@sourceware.org
Subject: gdb watch command on ppc
Date: Wed, 12 Oct 2005 21:14:00 -0000	[thread overview]
Message-ID: <OF3F5AE681.75D72D9F-ON87257098.00733AA0-86257098.0074AB0E@us.ibm.com> (raw)

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);
        }
}


             reply	other threads:[~2005-10-12 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-12 21:14 Claudia Salzberg [this message]
2005-10-12 21:20 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF3F5AE681.75D72D9F-ON87257098.00733AA0-86257098.0074AB0E@us.ibm.com \
    --to=salzberg@us.ibm.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).