Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: RFA: handle zero-length types in value_from_register
Date: Tue, 27 Jan 2004 05:36:00 -0000	[thread overview]
Message-ID: <vt21xpm6jh7.fsf@zenia.home> (raw)


2004-01-27  Jim Blandy  <jimb@redhat.com>

	* findvar.c (value_from_register): If the type has no length, just
	return an acceptable value --- don't report an internal error.

Index: gdb/findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.66
diff -c -r1.66 findvar.c
*** gdb/findvar.c	30 Sep 2003 19:12:18 -0000	1.66
--- gdb/findvar.c	27 Jan 2004 05:28:52 -0000
***************
*** 617,623 ****
    struct value *v = allocate_value (type);
    CHECK_TYPEDEF (type);
  
!   if (CONVERT_REGISTER_P (regnum, type))
      {
        /* The ISA/ABI need to something weird when obtaining the
           specified value from this register.  It might need to
--- 617,641 ----
    struct value *v = allocate_value (type);
    CHECK_TYPEDEF (type);
  
!   if (TYPE_LENGTH (type) == 0)
!     {
!       /* It doesn't matter much what we return for this: since the
!          length is zero, it could be anything.  But if allowed to see
!          a zero-length type, the register-finding loop below will set
!          neither mem_stor nor reg_stor, and then report an internal
!          error.  
! 
!          Zero-length types can legitimately arise from declarations
!          like 'struct {}'.  GDB also creates them when it finds bogus
!          debugging information (for example, TYPE_CODE_UNDEF has a
!          length of zero).
! 
!          We'll just attribute the value to the original register.  */
!       VALUE_LVAL (v) = lval_register;
!       VALUE_ADDRESS (v) = regnum;
!       VALUE_REGNO (v) = regnum;
!     }
!   else if (CONVERT_REGISTER_P (regnum, type))
      {
        /* The ISA/ABI need to something weird when obtaining the
           specified value from this register.  It might need to


             reply	other threads:[~2004-01-27  5:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-27  5:36 Jim Blandy [this message]
2004-01-27 14:05 ` Andrew Cagney
2004-01-27 15:38   ` Jim Blandy
2004-01-27 16:43     ` Andrew Cagney
2004-01-28  5:49       ` Jim Blandy
2004-02-18  3:14 Jim Blandy
2004-02-18 15:03 ` Andrew Cagney
2004-02-19 22:53   ` Jim Blandy

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=vt21xpm6jh7.fsf@zenia.home \
    --to=jimb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /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