11 years agoPatch ROSE instruction semantics to treat the PC as symbolic
Andrew Bernat [Thu, 18 Mar 2010 15:12:18 +0000 (10:12 -0500)]
Patch ROSE instruction semantics to treat the PC as symbolic

11 years agoPrototype implementation of slice->AST symbolic expansion mechanism.
Andrew Bernat [Thu, 11 Mar 2010 22:29:56 +0000 (16:29 -0600)]
Prototype implementation of slice->AST symbolic expansion mechanism.

11 years agoCorrectly implement sign-extension for constant types.
Andrew Bernat [Wed, 10 Mar 2010 23:00:31 +0000 (17:00 -0600)]
Correctly implement sign-extension for constant types.

11 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst
Andrew Bernat [Wed, 10 Mar 2010 22:19:13 +0000 (16:19 -0600)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst

11 years agoReimplementation of ASTs as non-templated to allow creation of visitor classes.
Andrew Bernat [Wed, 10 Mar 2010 22:17:06 +0000 (16:17 -0600)]
Reimplementation of ASTs as non-templated to allow creation of visitor classes.

11 years agoSymEval: remove redundant handling of PC for call instruction
Todd Frederick [Wed, 10 Mar 2010 17:27:08 +0000 (11:27 -0600)]
SymEval: remove redundant handling of PC for call instruction

11 years agoSymEval: Fix conversion to ROSE instruction involving implicit PC updates
Todd Frederick [Wed, 10 Mar 2010 16:38:49 +0000 (10:38 -0600)]
SymEval: Fix conversion to ROSE instruction involving implicit PC updates

11 years agoMerge branch 'master' of legendre@git.dyninst.org:/pub/dyninst
Matthew Legendre [Tue, 9 Mar 2010 21:54:37 +0000 (15:54 -0600)]
Merge branch 'master' of legendre@git.dyninst.org:/pub/dyninst

11 years agoMore fixes for StackwalkerAPI and new register interface
Matthew Legendre [Tue, 9 Mar 2010 21:48:43 +0000 (15:48 -0600)]
More fixes for StackwalkerAPI and new register interface

11 years agoFixes for PPC stackwalking
Matthew Legendre [Tue, 9 Mar 2010 21:44:18 +0000 (15:44 -0600)]
Fixes for PPC stackwalking

11 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst
Andrew Bernat [Tue, 9 Mar 2010 19:54:06 +0000 (13:54 -0600)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst

11 years agoSymEval and related bugfixes;
Andrew Bernat [Tue, 9 Mar 2010 19:53:19 +0000 (13:53 -0600)]
SymEval and related bugfixes;
Initial implementation of a find-and-replace AST mechanism;
Initial implementation of an AST-based stack slot resolver

11 years agoStackwalkerAPI fixes for working with new register class
Matthew Legendre [Tue, 9 Mar 2010 19:20:33 +0000 (13:20 -0600)]
StackwalkerAPI fixes for working with new register class

11 years agoAdd DWARF reg conversion to new register class
Matthew Legendre [Tue, 9 Mar 2010 19:20:10 +0000 (13:20 -0600)]
Add DWARF reg conversion to new register class

11 years agoAdded initial BindEval for stack slots;
Andrew Bernat [Fri, 5 Mar 2010 22:37:55 +0000 (16:37 -0600)]
Added initial BindEval for stack slots;
Fixed call handling in symbolic expansion;
Added AST substitutions.

11 years agoIntegration bug fixes.
Bill Williams [Fri, 5 Mar 2010 20:10:40 +0000 (14:10 -0600)]
Integration bug fixes.

11 years agoWarning cleanup.
Bill Williams [Thu, 4 Mar 2010 23:10:48 +0000 (17:10 -0600)]
Warning cleanup.

11 years agoFix Sparc build.
Bill Williams [Thu, 4 Mar 2010 21:48:29 +0000 (15:48 -0600)]
Fix Sparc build.

11 years agoRestore POWER/Linux PLT functionality
Bill Williams [Thu, 4 Mar 2010 18:26:44 +0000 (12:26 -0600)]
Restore POWER/Linux PLT functionality

11 years agoOptimizations for Synopsis
Bill Williams [Wed, 3 Mar 2010 22:53:27 +0000 (16:53 -0600)]
Optimizations for Synopsis

11 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst
Andrew Bernat [Thu, 4 Mar 2010 17:52:18 +0000 (11:52 -0600)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst

11 years agoAdd explicit flags register representations; SymEval bugfixes.
Andrew Bernat [Thu, 4 Mar 2010 17:51:59 +0000 (11:51 -0600)]
Add explicit flags register representations; SymEval bugfixes.

11 years agoMerge branch 'master' of legendre@git.dyninst.org:/pub/dyninst
Matthew Legendre [Wed, 3 Mar 2010 22:46:20 +0000 (16:46 -0600)]
Merge branch 'master' of legendre@git.dyninst.org:/pub/dyninst


11 years agoFurther work on AIX stackwalking
Matthew Legendre [Wed, 3 Mar 2010 21:02:22 +0000 (15:02 -0600)]
Further work on AIX stackwalking

11 years agoMerge branch 'master' of ssh://git.dyninst.org/pub/dyninst
Daniel McNulty [Wed, 3 Mar 2010 15:35:43 +0000 (09:35 -0600)]
Merge branch 'master' of ssh://git.dyninst.org/pub/dyninst

11 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst
Andrew Bernat [Wed, 3 Mar 2010 00:08:56 +0000 (18:08 -0600)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst


11 years agoBugfixes for slicing and general compile fixes for SymEval component
Andrew Bernat [Tue, 2 Mar 2010 23:28:34 +0000 (17:28 -0600)]
Bugfixes for slicing and general compile fixes for SymEval component

11 years agoSymEval: Use MachRegister interface
Todd Frederick [Tue, 2 Mar 2010 23:18:49 +0000 (17:18 -0600)]
SymEval: Use MachRegister interface

11 years agoRegister interface: Added converter to ROSE register type
Todd Frederick [Tue, 2 Mar 2010 22:40:14 +0000 (16:40 -0600)]
Register interface: Added converter to ROSE register type

11 years agoMerge branch 'master' of ssh://git.dyninst.org/pub/dyninst
Daniel McNulty [Tue, 2 Mar 2010 21:16:49 +0000 (15:16 -0600)]
Merge branch 'master' of ssh://git.dyninst.org/pub/dyninst

11 years agoFixed problems related to loading libraries introduced by a previous commit.
Daniel McNulty [Fri, 26 Feb 2010 17:41:24 +0000 (11:41 -0600)]
Fixed problems related to loading libraries introduced by a previous commit.

1) On platforms that do not support the binary rewriter, opening a binary with
BPatch_binaryEdit would fail because openResolvedLibraryName was not
implemented for these platforms. A generic version of openResolvedLibraryName
was implemented on these platforms. openResolvedLibraryName is now used to open
the RT library because it can be a collection of BinaryEdits in the static
binary case. Previously, the RT library was opened with openFile.

2) Prior to this commit, in order to work with a static binary via
BPatch_binaryEdit the DYNINSTAPI_RT_LIB environment variable needed to point
to the .a version of the RT lib. This inhibits a user from working with a
dynamic binary and a static binary at the same time. Now, the
DYNINSTAPI_RT_LIB variable is used to find the directory that holds both
versions of the RT library. The correct version is chosen depending on the
type of binary opened via BPatch_binaryEdit.

11 years agoAdd ROSE compatability enums
Todd Frederick [Tue, 2 Mar 2010 19:41:51 +0000 (13:41 -0600)]
Add ROSE compatability enums

11 years agoInitial SymEval prototype; stack analysis fixes to handle destroyed stack frames.
Andrew Bernat [Tue, 2 Mar 2010 19:26:39 +0000 (13:26 -0600)]
Initial SymEval prototype; stack analysis fixes to handle destroyed stack frames.

11 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst
Andrew Bernat [Mon, 1 Mar 2010 21:35:43 +0000 (15:35 -0600)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst


11 years agoFix stackanalysis for frame pointers.
Andrew Bernat [Mon, 1 Mar 2010 21:27:13 +0000 (15:27 -0600)]
Fix stackanalysis for frame pointers.

11 years agoSupport for StackwalkerAPI on AIX
Matthew Legendre [Fri, 26 Feb 2010 19:33:24 +0000 (13:33 -0600)]
Support for StackwalkerAPI on AIX

11 years agoFix dyninst fault when stripped code parsing libraries with 0 symbols in the dynamic...
Matthew Legendre [Fri, 26 Feb 2010 00:25:10 +0000 (18:25 -0600)]
Fix dyninst fault when stripped code parsing libraries with 0 symbols in the dynamic or regular symbol table.

11 years agoMissing instruction mnemonic
Nathan Rosenblum [Wed, 24 Feb 2010 18:02:12 +0000 (12:02 -0600)]
Missing instruction mnemonic

11 years agoRevert "fixes"
Nathan Rosenblum [Wed, 24 Feb 2010 17:59:58 +0000 (11:59 -0600)]
Revert "fixes"

This reverts commit eb01ebec7037bb84b386349f07660f6cbc0448d2.

11 years agoMerge branch 'master' of ssh://nater@git.dyninst.org/pub/dyninst
Nathan Rosenblum [Wed, 24 Feb 2010 16:25:00 +0000 (10:25 -0600)]
Merge branch 'master' of ssh://nater@git.dyninst.org/pub/dyninst

11 years agofixes
Nathan Rosenblum [Wed, 24 Feb 2010 16:24:57 +0000 (10:24 -0600)]

11 years agoIntegration bugfixes.
Bill Williams [Mon, 22 Feb 2010 19:22:15 +0000 (13:22 -0600)]
Integration bugfixes.

11 years agoPowerPC/Linux bug fixes: don't treat call-next-insn as an ABI-conforming call in...
Bill Williams [Mon, 22 Feb 2010 18:53:09 +0000 (12:53 -0600)]
PowerPC/Linux bug fixes: don't treat call-next-insn as an ABI-conforming call in liveness

11 years agoRemove some unnecessary duplicate operand construction.
Bill Williams [Mon, 22 Feb 2010 18:41:28 +0000 (12:41 -0600)]
Remove some unnecessary duplicate operand construction.

11 years agoSPR read/write set bugfix.
Bill Williams [Fri, 19 Feb 2010 23:18:49 +0000 (17:18 -0600)]
SPR read/write set bugfix.

11 years agoRemove dead include to List.h
Bill Williams [Fri, 19 Feb 2010 22:06:32 +0000 (16:06 -0600)]
Remove dead include to List.h

11 years agoAdd instructionAPI dependency to all powerpc/power makefiles.
Bill Williams [Fri, 19 Feb 2010 21:53:02 +0000 (15:53 -0600)]
Add instructionAPI dependency to all powerpc/power makefiles.

11 years agoFinal integration bugfixes and restoration of AIX/gcc4.2.0 compatibility
Bill Williams [Fri, 19 Feb 2010 21:23:54 +0000 (15:23 -0600)]
Final integration bugfixes and restoration of AIX/gcc4.2.0 compatibility

11 years agoKill warnings.
Bill Williams [Thu, 18 Feb 2010 20:38:07 +0000 (14:38 -0600)]
Kill warnings.

11 years agoFurther bug fixes: get tests using right architecture/address width, initialize Opera...
Bill Williams [Thu, 18 Feb 2010 20:28:46 +0000 (14:28 -0600)]
Further bug fixes: get tests using right architecture/address width, initialize Operation member variables correctly.

11 years agoStronger sanity checking for mod r/m displacements.
Bill Williams [Thu, 18 Feb 2010 19:14:55 +0000 (13:14 -0600)]
Stronger sanity checking for mod r/m displacements.

11 years agoUpdate to use new MachRegister class.
Bill Williams [Thu, 18 Feb 2010 19:14:35 +0000 (13:14 -0600)]
Update to use new MachRegister class.

11 years agoRemove pool allocator from IAPI shared pointer factory, since there's no way to make...
Bill Williams [Thu, 18 Feb 2010 19:14:21 +0000 (13:14 -0600)]
Remove pool allocator from IAPI shared pointer factory, since there's no way to make it thread-safe.

11 years agoParseDwarf bug fixes: strtoul replaces strtol, fixing a warning on pgcc mutatees...
Bill Williams [Thu, 18 Feb 2010 19:13:48 +0000 (13:13 -0600)]
ParseDwarf bug fixes: strtoul replaces strtol, fixing a warning on pgcc mutatees; bug fix for ia32 Dwarf register to MachRegister conversion.

11 years agoBug fixes for IA32/AMD64
Bill Williams [Thu, 18 Feb 2010 19:12:31 +0000 (13:12 -0600)]
Bug fixes for IA32/AMD64

11 years agoPPC32 Linux fixes
Bill Williams [Thu, 18 Feb 2010 19:11:11 +0000 (13:11 -0600)]
PPC32 Linux fixes

11 years agoReenable conversion to signed int for MachRegister, now that we've converted and...
Bill Williams [Mon, 15 Feb 2010 18:23:29 +0000 (12:23 -0600)]
Reenable conversion to signed int for MachRegister, now that we've converted and nobody can do anything too stupid.

11 years agoOptimizations & bugfixes:
Bill Williams [Mon, 15 Feb 2010 17:54:56 +0000 (11:54 -0600)]
Optimizations & bugfixes:
* Instructions get shared pointers to the correct decoder, rather than constructing fresh ones to decode operands.
* InstructionDecoder now has setBuffer(buffer, size) and resetBuffer() methods.  resetBuffer() resets to state before previous setBuffer().
* Added operands to a few x86 opcodes that were missing their read/write sets.
* Removed old architecture enum--everything should be going through MachRegister's architecture definitions now.
* InstructionDecoders no longer copyable--this should have been disabled when we went to factory construction, but wasn't.
* InstructionAdapter no longer tries to copy a decoder.

11 years agoMore debug logging; return false if no valid edges (not safe to relocate func w/jump...
Bill Williams [Thu, 11 Feb 2010 22:30:41 +0000 (16:30 -0600)]
More debug logging; return false if no valid edges (not safe to relocate func w/jump table).

11 years agoInstructionAPI Register formatting consistent with previous disassembly.
Bill Williams [Thu, 11 Feb 2010 20:23:19 +0000 (14:23 -0600)]
InstructionAPI Register formatting consistent with previous disassembly.

11 years agoAdd check for signal.h to 32-bit RTlib test to catch bad include setup.
Bill Williams [Thu, 11 Feb 2010 19:13:10 +0000 (13:13 -0600)]
Add check for signal.h to 32-bit RTlib test to catch bad include setup.

11 years agoAssorted bugfixes for registers with non-full widths.
Bill Williams [Thu, 11 Feb 2010 19:12:39 +0000 (13:12 -0600)]
Assorted bugfixes for registers with non-full widths.

11 years agoBugfixes:
Andrew Bernat [Thu, 4 Feb 2010 21:53:07 +0000 (15:53 -0600)]
Add missing registers in map from InstructionAPI registers to Dyninst internal registers
Do not segfault when generating an empty AST sequence node
Use codeGen index methods to rewind in baseTramp code generation
Use Result::convert in stack analysis instead of translating by hand
Bugfix in InstructionAPI mod/rm byte decoding
Fix accidentally decoding LEAs as using memory.
Consider writes to portions of registers (IA-32 aliasing) to be a use of the register as well
Correctly emit rex byte for instruction::generateMem
Correct decoding of REX + SIB expressions

11 years agoMassive changes to get InstructionAPI working with new MachRegister class.
Bill Williams [Wed, 10 Feb 2010 16:25:28 +0000 (10:25 -0600)]
Massive changes to get InstructionAPI working with new MachRegister class.
TODO: fix stack tests, fix thread tests, test cross-platform, code cleanup.

11 years agoNew MachRegister class: stackwalk-x86, parseDwarf, POWER IAPI integration
Bill Williams [Mon, 8 Feb 2010 17:01:19 +0000 (11:01 -0600)]
New MachRegister class: stackwalk-x86, parseDwarf, POWER IAPI integration

11 years agoFix parentheses.
Bill Williams [Thu, 4 Feb 2010 23:07:06 +0000 (17:07 -0600)]
Fix parentheses.

11 years agoAdd architecture bit.
Bill Williams [Thu, 4 Feb 2010 23:06:55 +0000 (17:06 -0600)]
Add architecture bit.

11 years agoAdded conditional branch instructions to ppc read/write set test.
Bill Williams [Thu, 4 Feb 2010 22:00:43 +0000 (16:00 -0600)]
Added conditional branch instructions to ppc read/write set test.

11 years agoPower liveness now using instructionAPI. Still needs cleanup, but works.
Bill Williams [Thu, 4 Feb 2010 21:53:09 +0000 (15:53 -0600)]
Power liveness now using instructionAPI.  Still needs cleanup, but works.

11 years agoIAPI/Power to dyn_regs based register IDs; liveness with cheap hack GPR conversion.
Bill Williams [Thu, 4 Feb 2010 18:15:32 +0000 (12:15 -0600)]
IAPI/Power to dyn_regs based register IDs; liveness with cheap hack GPR conversion.

11 years agobug fix for checking AIX 32 bit environment: -maix32, not -m32.
Bill Williams [Thu, 4 Feb 2010 17:32:44 +0000 (11:32 -0600)]
bug fix for checking AIX 32 bit environment: -maix32, not -m32.

11 years agoGet instruction categories right on Power--calls and returns need special handling...
Bill Williams [Thu, 4 Feb 2010 17:16:41 +0000 (11:16 -0600)]
Get instruction categories right on Power--calls and returns need special handling because we can't tell from just the opcode.

11 years agoAdded comparison instructions on Power to instruction categories.
Bill Williams [Thu, 4 Feb 2010 17:15:19 +0000 (11:15 -0600)]
Added comparison instructions on Power to instruction categories.

11 years agoAdd InstructionAPI to AIX/power build.
Bill Williams [Thu, 4 Feb 2010 17:14:23 +0000 (11:14 -0600)]
Add InstructionAPI to AIX/power build.

11 years agoSet architecture variable for power so we can use InstructionAPI.
Bill Williams [Thu, 4 Feb 2010 17:12:20 +0000 (11:12 -0600)]
Set architecture variable for power so we can use InstructionAPI.

11 years agoAdd power syscall instruction to IA_IAPI in preparation for power integration.
Bill Williams [Thu, 4 Feb 2010 17:11:37 +0000 (11:11 -0600)]
Add power syscall instruction to IA_IAPI in preparation for power integration.

11 years agoNew successor mechanism, comprehensive power CFT testing, added double Hummer tests...
Bill Williams [Fri, 29 Jan 2010 19:17:52 +0000 (13:17 -0600)]
New successor mechanism, comprehensive power CFT testing, added double Hummer tests for power.
FIXME: successor mechanism doesn't trigger delayed decode, needs explicit decode.
FIXME: new successor mechanism not used outside test suite
FIXME: new successor mechanism not consistent between x86 and power yet

11 years agoAdded test for blr instruction.
Bill Williams [Thu, 28 Jan 2010 21:30:43 +0000 (15:30 -0600)]
Added test for blr instruction.

11 years agoPower instructionAPI initial version. Read/write sets, all instruction forms tested...
Bill Williams [Thu, 28 Jan 2010 21:21:18 +0000 (15:21 -0600)]
Power instructionAPI initial version.  Read/write sets, all instruction forms tested decently.
TODO: full testing of Double Hummer insns, full testing of new CFT code.
TODO: massive cleanup of enum locations.
TODO: make all power registers printable.
Also included: changes to x86 decoder so that we can make CFTs work in a unified manner.

11 years agoDebug for Jim G.
Bill Williams [Wed, 27 Jan 2010 00:00:58 +0000 (18:00 -0600)]
Debug for Jim G.

11 years agoDefine max instruction size once and only once, and default-construct decoders with...
Bill Williams [Wed, 6 Jan 2010 18:02:24 +0000 (12:02 -0600)]
Define max instruction size once and only once, and default-construct decoders with a buffer the size of one max-length instruction if no size given

11 years ago* Added missing InstructionDecoder-x86 files to GIT.
Bill Williams [Wed, 6 Jan 2010 18:01:12 +0000 (12:01 -0600)]
* Added missing InstructionDecoder-x86 files to GIT.
* Added factory methods for dereference and register expressions to clean up decoder code.

11 years agoBuild fix
Bill Williams [Tue, 5 Jan 2010 22:05:57 +0000 (16:05 -0600)]
Build fix

11 years agoAdd instructionAPI test suite component to "make clean" target.
Bill Williams [Tue, 5 Jan 2010 21:21:17 +0000 (15:21 -0600)]
Add instructionAPI test suite component to "make clean" target.

11 years agoConvert InstructionDecoder to factory-based, shared pointer construction, taking...
Bill Williams [Tue, 5 Jan 2010 21:20:45 +0000 (15:20 -0600)]
Convert InstructionDecoder to factory-based, shared pointer construction, taking an architecture enum to determine derived type.
Separate InstructionDecoder into platform-independent and x86-specific parts, take 1.
Update Dyninst to use new decoder construction method.
Update image class to include its architecture.

11 years agoFixed a regression when loading a library via the openResolvedLibraryName
Daniel McNulty [Mon, 22 Feb 2010 23:47:49 +0000 (17:47 -0600)]
Fixed a regression when loading a library via the openResolvedLibraryName

I introduced a bug where the search to locate a library by name ended after
finding the first possible candidate for the library. However, on platforms
that have different ABI versions of the same library such as x86_64 Linux, this
behavior is incorrect because the 64-bit version could have been found when the
user was looking for the 32-bit version. The fix was to gather all possible
candidates for the library, iterate through these candidates in an order
dictated by standard convention, and select the first library that can be
opened successfully and matches the ABI of the original binary.

11 years agoSmall fix to turn off warning message for static binaries.
Daniel McNulty [Fri, 19 Feb 2010 21:20:56 +0000 (15:20 -0600)]
Small fix to turn off warning message for static binaries.

11 years agoMerge branch 'master' of ssh://git.dyninst.org/pub/dyninst
Daniel McNulty [Wed, 17 Feb 2010 22:43:53 +0000 (16:43 -0600)]
Merge branch 'master' of ssh://git.dyninst.org/pub/dyninst

11 years agoVarious small fixes to build on platforms besides x86.
Daniel McNulty [Thu, 11 Feb 2010 16:51:26 +0000 (10:51 -0600)]
Various small fixes to build on platforms besides x86.
Expanded comments and fixed typos.

11 years agoA working (but not thoroughly tested) version of the static binary rewriter
Daniel McNulty [Wed, 16 Dec 2009 21:36:36 +0000 (15:36 -0600)]
A working (but not thoroughly tested) version of the static binary rewriter
for static executables for both x86 and x86_64. Additionally, this includes
changes to support a static RT library, which is a collection of
AddressSpaces. Includes changes to Dyninst to support parsing of
relocatable files (.o's).
    Added a deque to the struct Config to store additional libraries to be loaded.
    Added code to load additional libraries. Also, factored code to load libraries
    outside of instrumentation loop.
    Added command line option '-l' to specify additional libraries, can be specified
    multiple times. Also, fixed --skip-func option.

    Added new files and flags used during a non-pic static library build.
    Added _32 non-pic static library as well for x86_64.
make.library.tmpl, dyninstAPI_RT/make.module.tmpl
    Added new target -- a non-pic static library. Added rules to build non-pic object
    Modified so static version of RT library does not depend on libpthreads or libdl
    Provides some functions for processing rewritten .ctors and .dtors sections.
    Provides a ___tls_get_addr that stands in for a function of the same name
    provided by the dynamic linker. Helps implement TLS for the static binary rewriter.

    Moved linkStatic and other functions of the static binary rewriter to a separate
    class to allow the code to be shared by emitElf and emitElf64. Also, made some
    changes to remove ifdefs and use architecture specific relocationEntry functions.
    Minor changes to move these functions to a separate class. Moved LinkMap to its
    own file. Can now emit a .bss section, and COMMON block creation is now more
    Created separate files for LinkMap structure.
    Modifications to support parsing of relocatable files. Added a field is_dynamic and
    accessor. Changes to relocationEntry -- factor architecture dependent functions to
    separate function. Changed interface of addExternalSymbolReference.
    Lots of small fixes related to how relocatable files are treated. Changed
    parse_all_relocations to be more efficient in its use of maps.
    Added architecture specific files instead of using ifdefs.
    Modified to classify shared objects correctly.

Changed RT library to be represented as a collection of AddressSpace objects instead of
a single AddressSpace object. This results with addition of iterations when searching
the RT library.

    Tramp guards can now be used when rewritting static binaries.

    Added ability to determine if a static binary is multithread capable (this is
    architecture dependent). Also, changed to accomodate interface change for
    addExternalSymbolReference. Added doStaticBinarySpecialCases necessary for
    processing static binaries. Init fini callbacks were turned off for static binaries.

    Added getPtrToInstruction function that works for relocatable files. Modified
    some uses of the previous function to use new version.

    Added some OS and architecture functions for processing special cases with static
    binaries. This includes functionality for replacing global constructor and
    destructor processing functions to use special constructor and destructor
    handlers. Special relocations are created for these handlers that are
    processed when the rewritten executable is emitted.

11 years agoMoved to architecture-dependent files instead of #defines. Also, created new
Daniel McNulty [Tue, 24 Nov 2009 16:15:04 +0000 (10:15 -0600)]
Moved to architecture-dependent files instead of #defines.  Also, created new
debugging printf (rewrite_printf) for debugging errors.

Fixed compiler warning

Added new debugging printf for rewriting stage

Added new architecture-dependent files(x86 and stub for unimplemented
architectures). This involved moving code around and creating some new
functions.  Converted all printfs to rewrite_printfs.  Expanded printing of
LinkMap to include ranges for objects and also ranges of functions.

11 years agoSome refactoring to the linker portion of emitElf code.
Daniel McNulty [Wed, 18 Nov 2009 21:48:03 +0000 (15:48 -0600)]
Some refactoring to the linker portion of emitElf code.

Added a new data structure, LinkMap, and split layout of new Regions and
copying of data into these new Regions into two different functions. The goal
with using LinkMap is to encapsulate all the necessary information to perform the
actual link once all the code, data, bss, etc are layed out in a buffer.

minor changes to emitElf to handle case where there is padding in between new
sections being added to the target. Also, removed some magic constants used when
working with the permissions of program headers.

11 years agoMore fixes to support TLS and section alignment. This is a
Daniel McNulty [Fri, 13 Nov 2009 17:36:40 +0000 (11:36 -0600)]
More fixes to support TLS and section alignment. This is a
commit before some significant refactoring of emitElf-static

Added accessor for the archives filename to help with debugging

createRegion now implemented. Also, Region's now members to describe
if they are thread local storage and store their memory alignment.
Also, addRegion extended for these properties.

symbols can be thread local. There was a TODO for this.

If a static binary has thread local storage, need to rewrite the section
to include new TLS sections. Based on flag set in linkStatic, a section
with WAT and PROGBITS flags will be written to include new TLS sections.

Added TLS support and for sections with specific memory alignments. Also,
fixed some bugs in other areas.

11 years agoBugfixes:
Andrew Bernat [Thu, 4 Feb 2010 21:53:07 +0000 (15:53 -0600)]
Add missing registers in map from InstructionAPI registers to Dyninst internal registers
Do not segfault when generating an empty AST sequence node
Use codeGen index methods to rewind in baseTramp code generation
Use Result::convert in stack analysis instead of translating by hand
Bugfix in InstructionAPI mod/rm byte decoding
Fix accidentally decoding LEAs as using memory.
Consider writes to portions of registers (IA-32 aliasing) to be a use of the register as well
Correctly emit rex byte for instruction::generateMem
Correct decoding of REX + SIB expressions

11 years agoA somewhat working version of the binary rewriter for static executables
Daniel McNulty [Tue, 27 Oct 2009 21:13:16 +0000 (16:13 -0500)]
A somewhat working version of the binary rewriter for static executables
and associated changes. The rewriter works on basic cases.


Modified (function) to process a map of BinaryEdits as returned from
openResolvedLibraryName instead of a single pair. This adds support for
processing Archives which can be thought of as a collection of BinaryEdits.


Added new parameter to openFile that allows one to specify the member name.
This parameter is not required and its default value is the empty string.  If
the parameter is set, the fileDescriptor's member field is set with the member

Changed code in writeFile for creating references to external symbols. It now
uses the new function in Symtab to specify that the Symtab has an external
symbol reference to the a specified Symbol


Refactored openResolvedLibraryName to handle static and dynamic executable
cases differently. Libraries (static or dynamic) are searched for in the exact
same way. Also, now returns map of BinaryEdits, instead of a single pair.

Can now open a Symtab via an Archive or the Symtab factory function, depending
on the state of the passed fileDescriptor object.

It is no longer an error to have duplicate symbols in the global symbol table.
Also, Symtab's store a reference to their parent Archive.

Added ability to add relocationEntry to Region given a reference to a

Symtab now stores a collection of Archive's that could be used for symbol
resolution during static linking. Also, it stores other Symtab's that are
referenced by a new undefined Symbol. Also, dtor now frees underlying
Object instance. Added getters/setters for these data structures.

Moved definition of relocationEntry to be completely inside Symtab* files.
Also, do not need a special type  of relocationEntry for ELF because
relocationEntries are now stored with a Region.

Fixed a bug where a C++ .o had a zero length text section due to use
of GROUPs. Just choose a executable section with a non-zero size to
replace the .text section.

Also, in dtor, free'd resources used by libelf.

Changed addSymbol to be different for static case

Lots of changes related to the above changes. Also, relocations
processed in generic way instead of in two separate functions.

11 years agoImplementation of binary rewriter for static executables that works with a set
Daniel McNulty [Wed, 14 Oct 2009 14:54:08 +0000 (09:54 -0500)]
Implementation of binary rewriter for static executables that works with a set
of .o's. This implementation works for some trival examples. This commit is
immediately before relocations were changed to be stored with their respective
target Region.

Added new field to class => boolean for if the symbol should be placed in COMMON

Added method to relocationEntry to set the target_addr.

Changes to support creation of Symbols with COMMON flag set. Some changes to
ELFRelocation, but this class will be removed.

Implementation of binary rewriter for static executables

11 years agoFirst draft of binary rewriter for static binaries. Contains additional
Daniel McNulty [Thu, 8 Oct 2009 15:58:02 +0000 (10:58 -0500)]
First draft of binary rewriter for static binaries. Contains additional
peripheral changes to support this feature.

symtabAPI/src/emitElf-static.C (new, added to Makefile for linux x86)

Holds core implementation of binary rewriter for static binaries. Functions
are still members of emitElf class. Moved to different file to keep file size
down (similar to Symtab-lookup.C and Symtab-edit.C)


Added prototypes for static binary case


Call to static binary "linker" code added in createSymbolTables


Reworked ELFRelocations. Relocations are now linked to Symbols correctly.


Minor changes

symtabAPI/src/staticRewrite.C (removed/merged into emitElf-static.C)

11 years agoAdded necessary support structure for the beginnings of the binary rewriter
Daniel McNulty [Thu, 1 Oct 2009 19:52:53 +0000 (14:52 -0500)]
Added necessary support structure for the beginnings of the binary rewriter
for static executables.


While writing out a binary, calls made by instrumentation to libraries are
stored as dependent relocations. In the dynamic binary case, these eventually
get added to the .dynamic section. In the static case, the dependent
relocations needed to be added to a seperate map stored with the Symtab object.


Added case for when the mutatee is a static executable, currently doesn't do
anything special. To be expanded to handle static libraries (.a's)


Re-worked almost all of this code. Exposed interface remains unchanged. Added
method to search the global symbol table in an archive. Also, added internal
data structures to get an Archive member given its offset, a global symbol it
defines, or its name. The only linker format dependent code is the parsing of
members, the parsing the global symbol table and the constructor.


Added support for storing inter-module Symbol references. Added methods for
retrieving a member name and member offset if it is a member of an Archive.
Added constructor for relocationEntry so it would be easier to subclass.


Added new ObjectType for object files. Added new SymtabError for when there is
a symbol collision when attempting to resolve symbols used by instrumentation
(indirectly or directly).


Added error check for when opening a in-memory image fails.


Added/removed code to allow a .o to parsed correctly

Added ability to parse ELF relocations in full. Defines class ELFRelocation
that is a derived class of relocationEntry. Adds some extra fields not
available in relocationEntry. Got rid of some magic constants


Added a SymtabError field so Symtab constructors can tell when there is an
error creating the underlying Object.


Added unit test for Archive class. Involved added some other classes for
integration into the test suite. Not set up to run with testsuite.

11 years agoRemove dangling symEval files
Andrew Bernat [Mon, 8 Feb 2010 23:40:16 +0000 (17:40 -0600)]
Remove dangling symEval files

11 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst into TBCommitted
Andrew Bernat [Mon, 8 Feb 2010 23:39:57 +0000 (17:39 -0600)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst into TBCommitted