public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* which elf symbol?
@ 2007-07-23 16:57 Andrew Cagney
  2007-07-26  2:27 ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2007-07-23 16:57 UTC (permalink / raw)
  To: frysk, Roland McGrath

Hi,

I've replaced the frysk-stackframe program with an expanded 
frysk-symbols program that has more elf symbol lookup edge cases; for 
instance nested symbols.  I've also expanded frysk.rt.TestSymbol to 
exercise them.  For some of the cases though, the results are not what I 
expected.   I've noted the failures below and provided a simplified 
assembler.

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-07  7:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-23 16:57 which elf symbol? Andrew Cagney
2007-07-26  2:27 ` Roland McGrath
2007-07-26 22:30   ` Andrew Cagney
2007-08-07  7:52     ` Roland McGrath

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