public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/8540: libgcc: execute_cfa_program() doesn`t handle 2 DWARF instructions properly
@ 2002-11-19 13:26 johnb
  0 siblings, 0 replies; only message in thread
From: johnb @ 2002-11-19 13:26 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-12  9:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-19 13:26 other/8540: libgcc: execute_cfa_program() doesn`t handle 2 DWARF instructions properly johnb

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).