From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5558 invoked by alias); 16 May 2010 12:04:19 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 5548 invoked by uid 22791); 16 May 2010 12:04:18 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Subject: Re: Patch for pascal-dynamic arrays Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: multipart/mixed; boundary=Apple-Mail-7--648494556 From: Jonas Maebe In-Reply-To: <20100515214421.GA9965@host0.dyn.jankratochvil.net> Date: Sun, 16 May 2010 12:04:00 -0000 Cc: Project Archer , Joost van der Sluis Message-Id: <4719101D-98D9-4000-9794-838695CDA95D@elis.ugent.be> References: <1256751286.31305.24.camel@wsjoost.cnoc.lan> <20091030094726.GA29758@host0.dyn.jankratochvil.net> <1257630529.27675.26.camel@wsjoost.cnoc.lan> <1271071502.27845.15.camel@wsjoost.cnoc.lan> <20100412195106.GA32767@host0.dyn.jankratochvil.net> <1271241292.21465.18.camel@wsjoost.cnoc.lan> <20100506230504.GA21919@host0.dyn.jankratochvil.net> <1273874250.9996.33.camel@wsjoost.cnoc.lan> <20100514224613.GA3338@host0.dyn.jankratochvil.net> <1273955042.32006.31.camel@wsjoost.cnoc.lan> <20100515214421.GA9965@host0.dyn.jankratochvil.net> To: Jan Kratochvil X-j-chkmail-Enveloppe: 4BEFDF38.002/91.182.44.192/[91.182.44.192]/[192.168.1.3]/ X-j-chkmail-Score: MSGID : 4BEFDF38.002 on smtp1.UGent.be : j-chkmail score : . : R=. U=. O=. B=0.000 -> S=0.000 X-j-chkmail-Status: Ham X-SW-Source: 2010-q2/txt/msg00025.txt.bz2 --Apple-Mail-7--648494556 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 1173 On 15 May 2010, at 23:44, Jan Kratochvil wrote: > But if the "allocation" is just an internal > compiler issue which should be hidden by the same compiler at the DWARF l= evel. > Therefore I would guess to use some: > drop DW_TAG_array_type -> DW_AT_allocated > DW_TAG_subrange_type -> DW_AT_upper_bound: > DW_OP_push_object_address > DW_OP_deref > DW_OP_dup > DW_OP_bra allocated > DW_OP_lit0 > DW_OP_skip end > allocated: > DW_OP_lit8 > DW_OP_minus > DW_OP_deref > end: I agree. Joost, I've attached a patch for FPC's DWARF writer to fix it. I c= an't test whether it works (the dumped DWARF info looks ok though), because= I can't get gdb/F-13 to build: *** ... Patch #329 (gdb-6.8-bz254229-gcore-prpsinfo.patch): + patch -p1 -s misordered hunks! output would be garbled 1 out of 3 hunks FAILED -- saving rejects to file bfd/elf.c.rej error: Bad exit status from /var/tmp/rpm-tmp.88969 (%prep) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.88969 (%prep) *** This is on a Scientific Linux 5.4 machine (which corresponds to RHEL 5.4). = Maybe I need a newer version of the "patch" utility? (it has version 2.5.4) Jonas --Apple-Mail-7--648494556 Content-Disposition: attachment; filename=fpc-dwarf3-arrstrupperbound.patch Content-Type: application/octet-stream; name="fpc-dwarf3-arrstrupperbound.patch" Content-Transfer-Encoding: 7bit Content-length: 5270 Index: dbgdwarf.pas =================================================================== --- dbgdwarf.pas (revision 15239) +++ dbgdwarf.pas (working copy) @@ -3558,9 +3558,6 @@ ]); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_push_object_address))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); - append_block1(DW_AT_allocated,2); - current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_push_object_address))); - current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.elementdef)); finish_entry; @@ -3568,10 +3565,19 @@ append_entry(DW_TAG_subrange_type,false,[ DW_AT_byte_stride,DW_FORM_udata,def.elesize, DW_AT_lower_bound,DW_FORM_udata,0, - DW_AT_upper_bound,DW_FORM_block1,5 + DW_AT_upper_bound,DW_FORM_block1,13 ]); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_push_object_address))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_dup))); + { pointer = nil? } + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_bra))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(4)); + { yes -> length = 0 } + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(3)); + { no -> load length } current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)+sizeof(ptrint))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_minus))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); @@ -3607,13 +3613,6 @@ we point to address of the string } current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); - - { also add how to detect whether or not the string is allocated: if the pointer is 0 - then it isn't, otherwise it is - } - append_block1(DW_AT_allocated,2); - current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_push_object_address))); - current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); end else begin @@ -3630,9 +3629,9 @@ if deref then begin if (chardef.size=1) then - upperopcodes:=5 + upperopcodes:=13 else - upperopcodes:=7; + upperopcodes:=15; { lower bound is always 1, upper bound (length) needs to be calculated } append_entry(DW_TAG_subrange_type,false,[ DW_AT_lower_bound,DW_FORM_udata,1, @@ -3642,14 +3641,24 @@ { high(string) is stored sizeof(ptrint) bytes before the string data } current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_push_object_address))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_dup))); + { pointer = nil? } + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_bra))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(4)); + { yes -> length = 0 } + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_skip))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(3)); + { no -> load length } current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit0)+sizeof(ptrint))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_minus))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref))); + { for widestrings, the length is specified in bytes, so divide by two } - if (upperopcodes=7) then + if (upperopcodes=15) then begin current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_lit1))); - current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_shra))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_shr))); end; end else --Apple-Mail-7--648494556--