This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
Re: gdb/2129: data moved into char array corrupts DWARF expression
- From: Daniel Jacobowitz <drow at false dot org>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 25 May 2006 17:18:02 -0000
- Subject: Re: gdb/2129: data moved into char array corrupts DWARF expression
- Reply-to: Daniel Jacobowitz <drow at false dot org>
The following reply was made to PR gdb/2129; it has been noted by GNATS.
From: Daniel Jacobowitz <drow@false.org>
To: stephen.branch@galileo.com
Cc: gdb-gnats@sources.redhat.com
Subject: Re: gdb/2129: data moved into char array corrupts DWARF expression
Date: Thu, 25 May 2006 13:13:18 -0400
On Thu, May 25, 2006 at 05:01:55PM -0000, stephen.branch@galileo.com wrote:
> 4: &Bcet = dwarf2_read_address: Corrupted DWARF expression.
> Disabling display 4 to avoid infinite recursion.
Can you supply the object file for table999.prolog.c, or even better, a
fully linked executable that shows the problem? Exactly
reproducing this sort of problem can depend on everything from the
compiler being used to the command line options; we need to work out if
the debug info is bad or if gdb is confused.
> (gdb) x/20c 0xf8d3848
> 0xf8d3848 <bcet_prologStringArea1>: 48 '0' 48 '0' 48 '0' 48 '0' 48 '0' 48 '0' 48 '0' 48 '0'
> 0xf8d3850 <bcet_prologStringArea1+8>: 0 '\0' 0 '\0' 0 '\0' 0 '\0' 0 '\0' 0 '\0' 0 '\0' 0 '\0'
> 0xf8d3858 <bcet_prologStringArea1+16>: 0 '\0' 0 '\0' 0 '\0' 0 '\0'
> (gdb) x/20c 0xfeef522c
> 0xfeef522c: 48 '0' 48 '0' 48 '0' 48 '0' 48 '0' 48 '0' 48 '0' 48 '0'
> 0xfeef5234: 12 '\f' 0 '\0' 0 '\0' 0 '\0' 1 '\001' 0 '\0' -1 'ÿ' -1 'ÿ'
> 0xfeef523c: 0 '\0' 0 '\0' 0 '\0' 0 '\0'
>
>
> Code in table999.prolog.c: (code being traced)
>
> 593 char Bcet[8];
> 594 char R6Bcet[8];
> 595 char Supplier[5];
> 596 char RuleNum[4];
> 597 char FareTariff[3];
> 598 char const *StringArea;
>
> 652 c_get_record1_v02_bcet(R1Ptr,R1SegNbr,&StringArea);
> 653 strncpy(Bcet,StringArea,sizeof(Bcet)); <- causes corruption of DWARF
> 654 c_get_supplier_code(FarePtr,&StringArea);
> 655 strncpy(Supplier,StringArea,sizeof(Supplier));
>
> Code in record1.v02.prolog.c:
>
> 60 char bcet_prologStringArea1[20];
> 61 static char prologStringArea1[20];
> 62 static char prologStringArea2[20];
> 63 static char prologStringArea3[20];
> 64 static char prologStringArea4[20];
> 65 static char prologStringArea5[20];
>
>
> 296 void c_get_record1_v02_bcet(struct R1Table *r1tp,
> 297 long segnbr,
> 298 char const **bcetOut)
> 299 {
> 300 char *bcet = bcet_prologStringArea1; <-- originally the static copy (prologStringArea1), this did not make a difference.
> 301 struct record1_V02 *r1;
> 302
> 303 *bcetOut = bcet_prologStringArea1;
> 304 memset(bcet_prologStringArea1,0,sizeof(bcet_prologStringArea1));
> 305
> 306 r1 = r1tp->R1;
> 307 memcpy(bcet,r1->rec1.segment[segnbr].rbdtblno,sizeof(r1->rec1.segment[segnbr].rbdtblno));
> 308 stripTrailingBlanks(bcet_prologStringArea1);
> 309 }
> >How-To-Repeat:
>
> >Fix:
>
> >Release-Note:
> >Audit-Trail:
> >Unformatted:
>
--
Daniel Jacobowitz
CodeSourcery