Bug 249490 - dwfl_module_addrsym misses nested symbols
Summary: dwfl_module_addrsym misses nested symbols
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: elfutils   
(Show other bugs)
Version: 7
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 173278
TreeView+ depends on / blocked
 
Reported: 2007-07-25 01:37 UTC by Andrew Cagney
Modified: 2007-11-30 22:12 UTC (History)
0 users

Fixed In Version: 0.129-1.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-08-29 17:30:50 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Candidate fix (3.96 KB, patch)
2007-07-26 17:02 UTC, Andrew Cagney
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 4830 None None None Never

Description Andrew Cagney 2007-07-25 01:37:26 UTC
1) testGlobalAfterNested(frysk.rt.TestSymbol)junit.framework.ComparisonFailure:
symbol global_outer expected:<global_outer> but was:<local_st_size_0>
  at frysk.rt.TestSymbol.symbolTest(TestRunner)
  at frysk.rt.TestSymbol.testGlobalAfterNested(TestRunner)
  at frysk.junit.Runner.runCases(TestRunner)
  at frysk.junit.Runner.runArchCases(TestRunner)
  at frysk.junit.Runner.runTestCases(TestRunner)
  at TestRunner.main(TestRunner)
2) testLocalAfterNested(frysk.rt.TestSymbol)junit.framework.ComparisonFailure:
symbol local_outer expected:<...outer> but was:<...st_size_0>
  at frysk.rt.TestSymbol.symbolTest(TestRunner)
  at frysk.rt.TestSymbol.testLocalAfterNested(TestRunner)
  at frysk.junit.Runner.runCases(TestRunner)
  at frysk.junit.Runner.runArchCases(TestRunner)
  at frysk.junit.Runner.runTestCases(TestRunner)
  at TestRunner.main(TestRunner)

These two are effectively the same.  The layout is:

   local_st_size_0: // this symbol has no size

   global_outer:
       nop
       local_in_global:
         nop
         .size local_in_global, .-local_in_global
      nop
      <<you-are-here>>
      .size global_outer, .-global_outer

that is global_outer contains a nested symbol but the "pc" is beyond that back
in the outer/global symbol.

I'm guessing that "global_outer" should be returned.  Currently local_st_size_0
is returned :-(


3)
testNoSymbolAfterGlobal(frysk.rt.TestSymbol)junit.framework.ComparisonFailure:
symbol [unknown] expected:<[unknown]> but was:<local_st_size_0>
  at frysk.rt.TestSymbol.symbolTest(TestRunner)
  at frysk.rt.TestSymbol.testNoSymbolAfterGlobal(TestRunner)
  at frysk.junit.Runner.runCases(TestRunner)
  at frysk.junit.Runner.runArchCases(TestRunner)
  at frysk.junit.Runner.runTestCases(TestRunner)
  at TestRunner.main(TestRunner)
4) testNoSymbolAfterLocal(frysk.rt.TestSymbol)junit.framework.ComparisonFailure:
symbol [unknown] expected:<[unknown]> but was:<local_st_size_0>
  at frysk.rt.TestSymbol.symbolTest(TestRunner)
  at frysk.rt.TestSymbol.testNoSymbolAfterLocal(TestRunner)
  at frysk.junit.Runner.runCases(TestRunner)
  at frysk.junit.Runner.runArchCases(TestRunner)
  at frysk.junit.Runner.runTestCases(TestRunner)
  at TestRunner.main(TestRunner)

This is the no-symbol case, there is a hole in the memory where there is no
valid symbol vis:

   local_st_size_0: // this symbol has no size

   global_symbol:
      nop
      nop
      .size global_symbol, .-global_symbol

   << you are here >>

I'm guessing it should not get a symbol at all (the [unknown]).  It currently
gets the nearest unsized symbol.

5)
testGlobalSize0InGlobal(frysk.rt.TestSymbol)junit.framework.ComparisonFailure:
symbol global_0_in_global expected:<...0_in_global> but was:<...after_0>
  at frysk.rt.TestSymbol.symbolTest(TestRunner)
  at frysk.rt.TestSymbol.testGlobalSize0InGlobal(TestRunner)
  at frysk.junit.Runner.runCases(TestRunner)
  at frysk.junit.Runner.runArchCases(TestRunner)
  at frysk.junit.Runner.runTestCases(TestRunner)
  at TestRunner.main(TestRunner)
6) testLocalSize0InGlobal(frysk.rt.TestSymbol)junit.framework.ComparisonFailure:
symbol local_0_in_global expected:<local_0_in_global> but was:<global_after_0>
  at frysk.rt.TestSymbol.symbolTest(TestRunner)
  at frysk.rt.TestSymbol.testLocalSize0InGlobal(TestRunner)
  at frysk.junit.Runner.runCases(TestRunner)
  at frysk.junit.Runner.runArchCases(TestRunner)
  at frysk.junit.Runner.runTestCases(TestRunner)
  at TestRunner.main(TestRunner)
7) testGlobalSize0InLocal(frysk.rt.TestSymbol)junit.framework.ComparisonFailure:
symbol global_0_in_local expected:<global_0_in_local> but was:<local_after_0>
  at frysk.rt.TestSymbol.symbolTest(TestRunner)
  at frysk.rt.TestSymbol.testGlobalSize0InLocal(TestRunner)
  at frysk.junit.Runner.runCases(TestRunner)
  at frysk.junit.Runner.runArchCases(TestRunner)
  at frysk.junit.Runner.runTestCases(TestRunner)
  at TestRunner.main(TestRunner)
8) testLocalSize0InLocal(frysk.rt.TestSymbol)junit.framework.ComparisonFailure:
symbol local_0_in_local expected:<...0_in_local> but was:<...after_0>
  at frysk.rt.TestSymbol.symbolTest(TestRunner)
  at frysk.rt.TestSymbol.testLocalSize0InLocal(TestRunner)
  at frysk.junit.Runner.runCases(TestRunner)
  at frysk.junit.Runner.runArchCases(TestRunner)
  at frysk.junit.Runner.runTestCases(TestRunner)
  at TestRunner.main(TestRunner)

These are cases where there is a nested symbol within a sized symbol vis:

   global_after_0:
      nop
      local_0_in_global:
         << you are here >>
      nop
      .size global_after_0, .-global_after_0

here, since the PC is exactly at the unsized local symbol I'm guessing that it
should return that.  It currently gets the containing sized symbol.

Comment 1 Andrew Cagney 2007-07-26 17:02:09 UTC
Created attachment 160041 [details]
Candidate fix

Ignore the printf's :-)

Comment 2 Andrew Cagney 2007-07-26 22:56:36 UTC
This gives a better fuzzy match.  Notice how it looks at the symbol's end, not
start.  If this matches a sized symbol it is later discarded.

	  /* Save the symbol which is "closer".  Use the end-address
	     so that a sized symbol that ends closer to an unsized
	     symbol wins (unsized symbols are typically created using
	     hand-written assembler).  */
	  if (sym.st_value + sym.st_size
	      >= closest_sym->st_value + closest_sym->st_size
	      && same_section (&sym, shndx))
	    {
	      closest ();
	      continue;
	    }
	}

Comment 3 Fedora Update System 2007-08-20 16:01:03 UTC
elfutils-0.129-1.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.

Comment 4 Fedora Update System 2007-08-29 17:30:44 UTC
elfutils-0.129-1.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.