History log of /llvm-project/llvm/tools/llvm-readobj/llvm-readobj.cpp (Results 151 – 175 of 258)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2
# 3780b3a9 18-Aug-2016 Saleem Abdulrasool <compnerd@compnerd.org>

llvm-readobj: handle import libraries with -coff-exports

`link -dump -exports` lists exported symbols from import libraries as well as
normal dlls. Ensure that we can handle import libraries as wel

llvm-readobj: handle import libraries with -coff-exports

`link -dump -exports` lists exported symbols from import libraries as well as
normal dlls. Ensure that we can handle import libraries as well in
llvm-readobj.

llvm-svn: 279069

show more ...


# 5e3e4bb2 05-Aug-2016 Zachary Turner <zturner@google.com>

[CodeView] Decouple record deserialization from visitor dispatch.

Until now, our use case for the visitor has been to take a stream of bytes
representing a type stream, deserialize the records in se

[CodeView] Decouple record deserialization from visitor dispatch.

Until now, our use case for the visitor has been to take a stream of bytes
representing a type stream, deserialize the records in sequence, and do
something with them, where "something" is determined by how the user
implements a particular set of callbacks on an abstract class.

For actually writing PDBs, however, we want to do the reverse. We have
some kind of description of the list of records in their in-memory format,
and we want to process each one. Perhaps by serializing them to a byte
stream, or perhaps by converting them from one description format (Yaml)
to another (in-memory representation).

This was difficult in the current model because deserialization and
invoking the callbacks were tightly coupled.

With this patch we change this so that TypeDeserializer is itself an
implementation of the particular set of callbacks. This decouples
deserialization from the iteration over a list of records and invocation
of the callbacks. TypeDeserializer is initialized with another
implementation of the callback interface, so that upon deserialization it
can pass the deserialized record through to the next set of callbacks. In
a sense this is like an implementation of the Decorator design pattern,
where the Deserializer is a decorator.

This will be useful for writing Pdbs from yaml, where we have a
description of the type records in Yaml format. In this case, the visitor
implementation would have each visitation callback method implemented in
such a way as to extract the proper set of fields from the Yaml, and it
could maintain state that builds up a list of these records. Finally at
the end we can pass this information through to another set of callbacks
which serializes them into a byte stream.

Reviewed By: majnemer, ruiu, rnk
Differential Revision: https://reviews.llvm.org/D23177

llvm-svn: 277871

show more ...


# 660230eb 04-Aug-2016 Zachary Turner <zturner@google.com>

[CodeView] Use llvm::Error instead of std::error_code.

This eliminates the remnants of std::error_code from the
DebugInfo libraries.

llvm-svn: 277758


Revision tags: llvmorg-3.9.0-rc1
# 6d9ca182 20-Jul-2016 Saleem Abdulrasool <compnerd@compnerd.org>

llvm-readobj: add some more aliases

Alias -d and -t from readelf in llvm-readobj which effectively replaces the
tool.

llvm-svn: 276075


# fc209623 14-Jul-2016 Lang Hames <lhames@gmail.com>

[Object] Re-apply r275316 now that I have the corresponding LLD patch ready.

llvm-svn: 275361


# ae610ab5 14-Jul-2016 Lang Hames <lhames@gmail.com>

[Object] Revert r275316, Archive::child_iterator changes, while I update lld.

Should fix the bots broken by r275316.

llvm-svn: 275353


# c2773e97 13-Jul-2016 Lang Hames <lhames@gmail.com>

[Object] Change Archive::child_iterator for better interop with Error/Expected.

See http://reviews.llvm.org/D22079

Changes the Archive::child_begin and Archive::children to require a reference
to a

[Object] Change Archive::child_iterator for better interop with Error/Expected.

See http://reviews.llvm.org/D22079

Changes the Archive::child_begin and Archive::children to require a reference
to an Error. If iterator increment fails (because the archive header is
damaged) the iterator will be set to 'end()', and the error stored in the
given Error&. The Error value should be checked by the user immediately after
the loop. E.g.:

Error Err;
for (auto &C : A->children(Err)) {
// Do something with archive child C.
}
// Check the error immediately after the loop.
if (Err)
return Err;

Failure to check the Error will result in an abort() when the Error goes out of
scope (as guaranteed by the Error class).

llvm-svn: 275316

show more ...


# 42398051 28-Jun-2016 Kevin Enderby <enderby@apple.com>

Finish cleaning up most of the error handling in libObject’s MachOUniversalBinary
and its clients to use the new llvm::Error model for error handling.

Changed getAsArchive() from ErrorOr<...> to Exp

Finish cleaning up most of the error handling in libObject’s MachOUniversalBinary
and its clients to use the new llvm::Error model for error handling.

Changed getAsArchive() from ErrorOr<...> to Expected<...> so now all
interfaces there use the new llvm::Error model for return values.

In the two places it had if (!Parent) this is actually a program error so changed
from returning errorCodeToError(object_error::parse_failed) to calling
report_fatal_error() with a message.

In getObjectForArch() added error messages to its two llvm::Error return values
instead of returning errorCodeToError(object_error::arch_not_found) with no
error message.

For the llvm-obdump, llvm-nm and llvm-size clients since the only binary files in
Mach-O Universal Binaries that are supported are Mach-O files or archives with
Mach-O objects, updated their logic to generate an error when a slice contains
something like an ELF binary instead of ignoring it. And added a test case for
that.

The last error stuff to be cleaned up for libObject’s MachOUniversalBinary is
the use of errorOrToExpected(Archive::create(ObjBuffer)) which needs
Archive::create() to be changed from ErrorOr<...> to Expected<...> first,
which I’ll work on next.

llvm-svn: 274079

show more ...


# 2ad6d48b 09-Jun-2016 Richard Smith <richard-llvm@metafoo.co.uk>

Search for llvm-symbolizer binary in the same directory as argv[0], before
looking for it along $PATH. This allows installs of LLVM tools outside of
$PATH to find the symbolizer and produce pretty ba

Search for llvm-symbolizer binary in the same directory as argv[0], before
looking for it along $PATH. This allows installs of LLVM tools outside of
$PATH to find the symbolizer and produce pretty backtraces if they crash.

llvm-svn: 272232

show more ...


Revision tags: llvmorg-3.8.1, llvmorg-3.8.1-rc1
# 2da433ea 02-Jun-2016 Reid Kleckner <rnk@google.com>

[COFF] Expose the PE debug data directory and dump it

This directory is used to find if there is a PDB associated with an
executable. I plan to use this functionality to teach llvm-symbolizer
whethe

[COFF] Expose the PE debug data directory and dump it

This directory is used to find if there is a PDB associated with an
executable. I plan to use this functionality to teach llvm-symbolizer
whether it should use DIA or DWARF to symbolize a given DLL.

Reviewers: majnemer

Differential Revision: http://reviews.llvm.org/D20885

llvm-svn: 271539

show more ...


# 9acb1099 31-May-2016 Kevin Enderby <enderby@apple.com>

Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is from a slice of a Mach-O Universal Binary use something like
"foo.o (for architecture i386)" as part

Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is from a slice of a Mach-O Universal Binary use something like
"foo.o (for architecture i386)" as part of the error message when expected.

Also fixed places in these tools that were ignoring object file errors from
MachOUniversalBinary::getAsObjectFile() when the code moved on to see if
the slice was an archive.

To do this MachOUniversalBinary::getAsObjectFile() and
MachOUniversalBinary::getObjectForArch() were changed from returning
ErrorOr<...> to Expected<...> then that was threaded up to its users.

Converting these interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now the use of
errorToErrorCode() is still used in two places yet to be fully converted.

llvm-svn: 271332

show more ...


# ac9e1555 17-May-2016 Kevin Enderby <enderby@apple.com>

Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is in an archive to use something like libx.a(foo.o) as part of
the error message.

Also changed llvm-ob

Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is in an archive to use something like libx.a(foo.o) as part of
the error message.

Also changed llvm-objdump and llvm-size to be like llvm-nm and ignore non-object
files in archives and not produce any error message.

To do this Archive::Child::getAsBinary() was changed from ErrorOr<...> to
Expected<...> then that was threaded up to its users.

Converting this interface to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now the use of
errorToErrorCode() is still used in one place yet to be fully converted.

Again there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comments for those.

llvm-svn: 269784

show more ...


# 0b269748 14-May-2016 Reid Kleckner <rnk@google.com>

[codeview] Add type stream merging prototype

Summary:
This code is intended to be used as part of LLD's PDB writing. Until
that exists, this is exposed via llvm-readobj for testing purposes.

Type s

[codeview] Add type stream merging prototype

Summary:
This code is intended to be used as part of LLD's PDB writing. Until
that exists, this is exposed via llvm-readobj for testing purposes.

Type stream merging uses the following algorithm:

- Begin with a new empty stream, and a new empty hash table that maps
from type record contents to new type index.
- For each new type stream, maintain a map from source type index to
destination type index.
- For each record, copy it and rewrite its type indices to be valid in
the destination type stream.
- If the new type record is not already present in the destination
stream hash table, append it to the destination type stream, assign it
the next type index, and update the two hash tables.
- If the type record already exists in the destination stream, discard
it and update the type index map to forward the source type index to
the existing destination type index.

Reviewers: zturner, ruiu

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20122

llvm-svn: 269521

show more ...


# 8a71b53e 04-May-2016 Simon Atanasyan <simon@atanasyan.com>

[llvm-readobj] Print MIPS .MIPS.options section content

.MIPS.options section specifies miscellaneous options to be applied
to an object file. LLVM as well as modern versions of GNU tools emit
the o

[llvm-readobj] Print MIPS .MIPS.options section content

.MIPS.options section specifies miscellaneous options to be applied
to an object file. LLVM as well as modern versions of GNU tools emit
the only type of the options - ODK_REGINFO. The patch teaches llvm-readobj
to print details of the ODK_REGINFO and skip contents of other options.

llvm-svn: 268478

show more ...


# 88bb163f 03-May-2016 Zachary Turner <zturner@google.com>

Move llvm-readobj/StreamWriter to Support.

We wish to re-use this from llvm-pdbdump, and it provides a nice
way to print structured data in scoped format that could prove
useful for many other dumpi

Move llvm-readobj/StreamWriter to Support.

We wish to re-use this from llvm-pdbdump, and it provides a nice
way to print structured data in scoped format that could prove
useful for many other dumping tools as well. Moving to support
and changing name to ScopedPrinter to better reflect its purpose.

llvm-svn: 268342

show more ...


# 9b1b7f08 11-Apr-2016 Hemant Kulkarni <khemant@codeaurora.org>

[llvm-readobj] Add ELF hash histogram printing

Differential Revision: http://reviews.llvm.org/D18907

llvm-svn: 265967


# 3fcdf6ae 06-Apr-2016 Kevin Enderby <enderby@apple.com>

Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message

Produce the first specific error message for a malformed Mach-O file describing
the problem

Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message

Produce the first specific error message for a malformed Mach-O file describing
the problem instead of the generic message for object_error::parse_failed of
"Invalid data was encountered while parsing the file”.  Many more good error
messages will follow after this first one.

This is built on Lang Hames’ great work of adding the ’Error' class for
structured error handling and threading Error through MachOObjectFile
construction. And making createMachOObjectFile return Expected<...> .

So to to get the error to the llvm-obdump tool, I changed the stack of
these methods to also return Expected<...> :

object::ObjectFile::createObjectFile()
object::SymbolicFile::createSymbolicFile()
object::createBinary()

Then finally in ParseInputMachO() in MachODump.cpp the error can
be reported and the specific error message can be printed in llvm-objdump
and can be seen in the existing test case for the existing malformed binary
but with the updated error message.

Converting these interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now use of
errorToErrorCode() and errorOrToExpected() are used where the callers
are yet to be converted.

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values. So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
“// TODO: Actually report errors helpfully” and a call something like
consumeError(ObjOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along
with this that I will commit right after this. So expect lld not to built
after this commit and before the next one.

llvm-svn: 265606

show more ...


Revision tags: llvmorg-3.8.0
# d59b23a5 01-Mar-2016 Tim Northover <tnorthover@apple.com>

Fix typo. NFC.

llvm-svn: 262405


Revision tags: llvmorg-3.8.0-rc3
# d8a985ec 10-Feb-2016 Hemant Kulkarni <khemant@codeaurora.org>

[llvm-readobj] Option to emit readelf like output

New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.ll

[llvm-readobj] Option to emit readelf like output

New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.llvm.org/D14128

llvm-svn: 260430

show more ...


# f46c92fe 10-Feb-2016 Hemant Kulkarni <khemant@codeaurora.org>

Revert "[llvm-readobj] Option to emit readelf like output"

This reverts commit a58765909660a7195b32e0cc8c7476168b913750.

llvm-svn: 260397


# 4f2ca0d2 10-Feb-2016 Hemant Kulkarni <khemant@codeaurora.org>

[llvm-readobj] Option to emit readelf like output

New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.ll

[llvm-readobj] Option to emit readelf like output

New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.llvm.org/D14128

llvm-svn: 260391

show more ...


Revision tags: llvmorg-3.8.0-rc2
# ab4a46fa 26-Jan-2016 Hemant Kulkarni <khemant@codeaurora.org>

[llvm-readobj] Add -elf-section-groups option

Adds a way to inspect SHT_GROUP sections in ELF objects.
Displays signature, member sections of these sections.

Differential revision: http://reviews.l

[llvm-readobj] Add -elf-section-groups option

Adds a way to inspect SHT_GROUP sections in ELF objects.
Displays signature, member sections of these sections.

Differential revision: http://reviews.llvm.org/D16555

llvm-svn: 258845

show more ...


Revision tags: llvmorg-3.8.0-rc1
# 0a07a820 23-Dec-2015 Davide Italiano <davide@freebsd.org>

[llvm-readobj] Use stderr and not stdout for error messages.

llvm-svn: 256347


# 83ebad37 16-Dec-2015 Reid Kleckner <rnk@google.com>

Reland "[llvm-readobj] Simplify usage of -codeview flag"

Relands r255790 with fixed tests.

llvm-svn: 255793


# b88796ba 16-Dec-2015 Reid Kleckner <rnk@google.com>

Revert "[llvm-readobj] Simplify usage of -codeview flag"

This reverts commit r255790.

llvm-svn: 255791


1234567891011