From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25500 invoked by alias); 30 Mar 2003 16:18:01 -0000 Mailing-List: contact gdb-prs-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sources.redhat.com Received: (qmail 25485 invoked by uid 71); 30 Mar 2003 16:18:01 -0000 Resent-Date: 30 Mar 2003 16:18:01 -0000 Resent-Message-ID: <20030330161801.25484.qmail@sources.redhat.com> Resent-From: gdb-gnats@sources.redhat.com (GNATS Filer) Resent-Cc: gdb-prs@sources.redhat.com Resent-Reply-To: gdb-gnats@sources.redhat.com, moriyoshi@at.wakwak.com Received: (qmail 25303 invoked by uid 48); 30 Mar 2003 16:17:00 -0000 Message-Id: <20030330161700.25302.qmail@sources.redhat.com> Date: Sun, 30 Mar 2003 16:28:00 -0000 From: moriyoshi@at.wakwak.com Reply-To: moriyoshi@at.wakwak.com To: gdb-gnats@sources.redhat.com X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: exp/1158: dereferencing a pointer to a function clobbers arguments' value when invoking it in the expression X-SW-Source: 2003-q1/txt/msg00690.txt.bz2 List-Id: >Number: 1158 >Category: exp >Synopsis: dereferencing a pointer to a function clobbers arguments' value when invoking it in the expression >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: maintenance >Submitter-Id: net >Arrival-Date: Sun Mar 30 16:18:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: moriyoshi@at.wakwak.com >Release: 5.3-debian >Organization: >Environment: Linux(2.4.20pre5) + glibc(2.3.1) >Description: When trying to invoke a function in a gdb expression that is dereferencing the pointer to the function from a pointer to a structure, the value of the first argument is unexpectedly replaced by the same value as the address of the dereferenced pointer (i.e. pointer to the structure). >How-To-Repeat: A snippet to reproduce this problem: #include void test(int c) { printf("%d\n", c + 2); } int main(int argc, char **argv) { struct { void (*t)(int c); } t, *pt; t.t = test; pt = &t; } $ gdb test GNU gdb 5.3-debian Copyright 2002 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 "i386-linux"... (gdb) break test.c:15 Breakpoint 1 at 0x804836b: file test.c, line 15. (gdb) run Starting program: /tmp/test Breakpoint 1, main (argc=1, argv=0xbffffda4) at test.c:15 15 } (gdb) print *pt $1 = {t = 0x8048328 } (gdb) call test(1, 3) 3 7 (gdb) call pt->t(1, 3) -1073742522 5 (gdb) printf "%d\n", pt -1073742524 >Fix: >Release-Note: >Audit-Trail: >Unformatted: