public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: johnb@stl.sarov.ru
To: gcc-gnats@gcc.gnu.org
Subject: other/8540: libgcc: execute_cfa_program() doesn`t handle 2 DWARF instructions properly
Date: Tue, 19 Nov 2002 13:26:00 -0000	[thread overview]
Message-ID: <20021112091358.8538.qmail@sources.redhat.com> (raw)


>Number:         8540
>Category:       other
>Synopsis:       libgcc: execute_cfa_program() doesn`t handle 2 DWARF instructions properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 12 01:16:04 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Eugeny Belov
>Release:        gcc 3.2
>Organization:
>Environment:
Red Hat Linux 8.0, default gcc 3.2 and its sources.
>Description:
Source file gcc/unwind-dw2.c have the function execute_cfa_program(), part of its code is below:
...
	case DW_CFA_restore_extended:
	  insn_ptr = read_uleb128 (insn_ptr, &reg);
	  fs->regs.reg[reg].how = REG_UNSAVED;
	  break;

	case DW_CFA_undefined:
	case DW_CFA_same_value:
	case DW_CFA_nop:
	  break;
...
  In case of DW_CFA_undefined and DW_CFA_same_value this function does nothing, but according to DWARF Debugging Information Format document (I have rev.2.1 Draft 5DW (Nov 30,2000)) section 6.4.2 (Call Frame Instructions).10,11 "the DW_CFA_undefined and DW_CFA_same_value instructions take a single unsigned LEB128 argument that represents a register number. The required action is to set the rule for the specified register to "undefined" or "same_value" in corresponding cases".
  Also I noted that emitting of these instructions is correct (source file gcc/dwarf2out.c:output_cfi()) but these instructions never go to the output CFI, so this is not a problem for gcc compiled programs, but may cause problems with modules built by other compilers.
>How-To-Repeat:

>Fix:
Small changes to the gcc/unwind-dw2.c (execute_cfa_program()):
...
	case DW_CFA_undefined:
	  insn_ptr = read_uleb128 (insn_ptr, &reg);
	  // if it will be used also something like this
          // fs->regs.reg[reg].how = REG_UNDEFINED;
	  break;

	case DW_CFA_same_value:
	  insn_ptr = read_uleb128 (insn_ptr, &reg);
	  // if it will be used also something like this
          // fs->regs.reg[reg].how = REG_SAMEVALUE;
	  break;

	case DW_CFA_nop:
	  break;
...
>Release-Note:
>Audit-Trail:
>Unformatted:


                 reply	other threads:[~2002-11-12  9:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20021112091358.8538.qmail@sources.redhat.com \
    --to=johnb@stl.sarov.ru \
    --cc=gcc-gnats@gcc.gnu.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).