]> Cypherpunks repositories - gostls13.git/commit
debug/elf: add (*File).DynamicSymbols, ErrNoSymbols, and tests for (*File).Symbols...
authorPietro Gagliardi <pietro10@mac.com>
Thu, 10 Jul 2014 19:44:40 +0000 (12:44 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 10 Jul 2014 19:44:40 +0000 (12:44 -0700)
commitf5b600f70cbe1e504a7623a7e0636535c49ea6c8
tree15a781cb60f048f972c23740604a5490f93308e8
parent54d0b5ab6a45dd9c0d8cf27ada3200c2f5ec6b28
debug/elf: add (*File).DynamicSymbols, ErrNoSymbols, and tests for (*File).Symbols and (*File).DynamicSymbols, and formalize symbol order.

Added a complement to (*File).Symbols for the dynamic symbol table.
Would be useful, for instance, if seraching for certain shared objects
compatible with certain libraries (for instance, LADSPA requires an
exported symbol "ladspa_descriptor").

Added a variable ErrNoSymbols that canonicalizes a return from
(*File).Symbols and (*File).DyanmicSymbols if the file has no symbols.

Added tests for both (*File).Symbols and (*File).DynamicSymbols;
there was never a test for (*File).Symbols at all. A small C program using
libelf, included in the test data, was used to produce the golden
symbols to compare against.

As part of the requirements for testing, (*File).Symbols and (*File).DynamicSymbols now document the order in which the symbol tables are returned (in the order the symbols appear in the file).

All tests currently pass.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/107530043
src/pkg/debug/elf/file.go
src/pkg/debug/elf/symbols_test.go [new file with mode: 0644]