Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Christopher Philip SMITH <chris.smith@st.com>
Cc: gdb@sourceware.org, Sean MCGOOGAN <sean.mcgoogan@st.com>
Subject: Re: Allocation of dwarf2_frame_state_reg_info
Date: Wed, 22 Mar 2006 15:50:00 -0000	[thread overview]
Message-ID: <20060321142041.GB15578@nevyn.them.org> (raw)
In-Reply-To: <4416EC57.2000107@st.com>

On Tue, Mar 14, 2006 at 04:16:23PM +0000, Christopher Philip SMITH wrote:
> In dwarf2-frame.c:dwarf2_frame_cache(), the two 
> dwarf2_frame_state_reg_infos, fs->regs and fs->initial, seem to be 
> allocated by calls to dwarf2_frame_state_alloc_regs() in only some cases 
> of execute_cfa_program(). In the case of the function above, none of the 
> cases exercised while going through the CIE result in an allocation, 
> which has the effect back in dwarf2_frame_cache() of leaving fs->initial 
> unallocated, and so uninitialised.

Well, it's not entirely uninitialized, is it?  At least it was memset
to zeroes.

> Later, when processing the FDE, a 
> DW_CFA_restore is encountered which reads from fs->initial and causes 
> the error...

          dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
          if (reg < fs->initial.num_regs)
            fs->regs.reg[reg] = fs->initial.reg[reg];
          else 
            fs->regs.reg[reg].how = DWARF2_FRAME_REG_UNSPECIFIED;

Are we looking at the same version of GDB here?

> My question is, what is the reasoning behind only allocating the 
> dwarf2_frame_state_reg_infos in execute_cfa_program()? It seems that if 
> both fs->regs and fs->initial were allocated with the dwarf2_frame_state 
> at the beginning of dwarf2_frame_cache(), then all the registers would 
> be set as "undefined" unless explicitly changed when processing the 
> DWARF (standard behaviour?) and the uninitialised read could never 
> happen? Is it only a case of avoiding unnecessary allocation, or is 
> there something more subtle going on here?

The problem is that we have no idea how many columns there are.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2006-03-21 14:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-14 17:21 Christopher Philip SMITH
2006-03-22 15:50 ` Daniel Jacobowitz [this message]
2006-03-22 22:01   ` Christopher SMITH

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=20060321142041.GB15578@nevyn.them.org \
    --to=drow@false.org \
    --cc=chris.smith@st.com \
    --cc=gdb@sourceware.org \
    --cc=sean.mcgoogan@st.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