public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Subject: Re: [rfa] frame address size incorrect if address size != ptr size
Date: Thu, 05 Aug 2010 16:52:00 -0000	[thread overview]
Message-ID: <201008051651.o75GpmTo002448@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20100805153010.GG4610@calimero.vinschen.de> from "Corinna Vinschen" at Aug 05, 2010 05:30:10 PM

Corinna Vinschen wrote:

> Index: dwarf2-frame.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
> retrieving revision 1.114
> diff -u -p -r1.114 dwarf2-frame.c
> --- dwarf2-frame.c	7 Jul 2010 17:26:38 -0000	1.114
> +++ dwarf2-frame.c	5 Aug 2010 15:25:27 -0000
> @@ -1732,13 +1732,6 @@ decode_frame_entry_1 (struct comp_unit *
>           depends on the target address size.  */
>        cie->encoding = DW_EH_PE_absptr;
>  
> -      /* The target address size.  For .eh_frame FDEs this is considered
> -	 equal to the size of a target pointer.  For .dwarf_frame FDEs, 
> -	 this is supposed to be the target address size from the associated
> -	 CU header.  FIXME: We do not have a good way to determine the 
> -	 latter.  Always use the target pointer size for now.  */
> -      cie->addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
> -
>        /* We'll determine the final value later, but we need to
>  	 initialize it conservatively.  */
>        cie->signal_frame = 0;
> @@ -1779,7 +1772,7 @@ decode_frame_entry_1 (struct comp_unit *
>  	}
>        else
>  	{
> -	  cie->addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
> +	  cie->addr_size = gdbarch_dwarf2_addr_size (gdbarch);
>  	  cie->segment_size = 0;
>  	}

Ah, wait a minute -- now we're missing the distinction between .eh_frame
and .debug_frame again.  For .eh_frame, FDE encodings needs to keep using
ptr_bit as discussed earlier, even on targets that do define a non-default
gdbarch_dwarf2_addr_size.  Sorry for not noticing earlier.

In fact, this means we might as well fix the inconsistent use between
addr_size as input to read_encoded_value (which needs to be ptr_size
on .eh_frame and addr_size on .debug_frame), and addr_size as input
to execute_stack_op (which needs to be addr_size always).

Could you add a second variable ptr_size to struct dwarf2_cie, and
initialize it (after the addr_size initialization) along the lines of:

  if (eh_frame_p)
    cie->ptr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
  else
    cie->ptr_size = cie->addr_size;

and then change all calls to read_encoded_value throughout dwarf2-frame.c
to pass cie->ptr_size instead of cie->addr_size.

It would then be interesting to see whether *both* .debug_frame and
.eh_frame work on xstormy16 ... you might be able to try the latter
by building with -fasynchronous-unwind-tables.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2010-08-05 16:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 14:53 Corinna Vinschen
2010-08-04 11:35 ` Corinna Vinschen
2010-08-04 22:40   ` Jan Kratochvil
2010-08-05  8:06     ` Corinna Vinschen
2010-08-05 10:04       ` Ulrich Weigand
2010-08-05 12:30         ` Corinna Vinschen
2010-08-05 14:08           ` Ulrich Weigand
2010-08-05 14:30             ` Corinna Vinschen
2010-08-05 14:59               ` Ulrich Weigand
2010-08-05 15:30                 ` Corinna Vinschen
2010-08-05 16:52                   ` Ulrich Weigand [this message]
2010-08-06 10:48                     ` Corinna Vinschen
2010-08-06 11:17                       ` Mark Kettenis
2010-08-06 12:01                         ` Corinna Vinschen
2010-08-06 14:51                       ` Ulrich Weigand
2010-08-06 15:57                         ` Corinna Vinschen
2010-08-06 16:27                           ` Ulrich Weigand
2010-08-06 16:59                             ` Corinna Vinschen
2010-08-06 19:03                               ` Corinna Vinschen
2010-08-08 14:55                                 ` Ulrich Weigand

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=201008051651.o75GpmTo002448@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@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).