dyninst.git
5 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst
Matthew LeGendre [Mon, 27 Jan 2014 18:45:41 +0000 (10:45 -0800)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst

Conflicts:
CMakeLists.txt

5 years agoUpdated parseAPI documentation PDF (missed in previous commit)
Emily Jacobson [Mon, 27 Jan 2014 16:36:42 +0000 (10:36 -0600)]
Updated parseAPI documentation PDF (missed in previous commit)

5 years agoFixed SymtabAPI documentation example 3 to use current API
Emily Jacobson [Mon, 27 Jan 2014 16:35:26 +0000 (10:35 -0600)]
Fixed SymtabAPI documentation example 3 to use current API

5 years agoExport r_debug from the RTlib on Linux and
Emily Jacobson [Wed, 22 Jan 2014 19:10:39 +0000 (13:10 -0600)]
Export r_debug from the RTlib on Linux and
verify that it's properly present before trying to use.

5 years agoClean up bad merge
Bill Williams [Fri, 17 Jan 2014 22:12:31 +0000 (16:12 -0600)]
Clean up bad merge

5 years agoCMake 2.6 compatibility fixes.
Bill Williams [Wed, 15 Jan 2014 19:51:31 +0000 (13:51 -0600)]
CMake 2.6 compatibility fixes.

More messages during build

5 years agoWarning cleanup
Bill Williams [Wed, 15 Jan 2014 19:51:15 +0000 (13:51 -0600)]
Warning cleanup

5 years agoMerge branch 'findMain'
Josh Stone [Fri, 17 Jan 2014 02:44:54 +0000 (18:44 -0800)]
Merge branch 'findMain'

5 years agoisTailcall fix: fallthroughs are not tailcalls
Emily Jacobson [Thu, 16 Jan 2014 20:06:12 +0000 (14:06 -0600)]
isTailcall fix: fallthroughs are not tailcalls

5 years agodyninstAPI: Set image::findMain's findings as LOCAL/INTERNAL
Josh Stone [Wed, 15 Jan 2014 19:20:32 +0000 (11:20 -0800)]
dyninstAPI: Set image::findMain's findings as LOCAL/INTERNAL

When we look for new symbols in image::findMain, it's not really the
intent to make these global/exported symbols.  It doesn't matter so much
for live processes, but these shouldn't be exported in rewritten
binaries.  This patch sets them as LOCAL and INTERNAL instead.

Note, this is only for Linux and FreeBSD, but Windows may want it too.

5 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst
Matthew LeGendre [Wed, 15 Jan 2014 00:10:57 +0000 (16:10 -0800)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst

Conflicts:
CMakeLists.txt

5 years agodyninstAPI: Expand powerpc support in image::findMain
Josh Stone [Tue, 14 Jan 2014 20:34:10 +0000 (12:34 -0800)]
dyninstAPI: Expand powerpc support in image::findMain

First, this function needs to respect the ELF entry address, rather than
assuming that entry is at the start of the .text section.  This was
already handled in x86, so we just need the same in powerpc.

Second, we need to add ppc64 support to the section which currently
handles ppc32.  This requires dereferencing .opd indirection, and ppc64
also uses a TOC-based load which the current dataflowAPI code can't
handle.  For this case, just use a simple InstructionAPI eval with the
known TOC r2 register.

5 years agodyninstAPI: Let image::findMain inspect PIE too
Josh Stone [Tue, 14 Jan 2014 21:39:36 +0000 (13:39 -0800)]
dyninstAPI: Let image::findMain inspect PIE too

Position-independent executables (PIE) are generally indistinguishable
from any other shared object, but we still need to find main() in these
when they're stripped.  One clue is the presence of INTERP, which PIEs
will always have.  (Some DSOs also have INTERP, but this is rare.)

5 years agoFix AddressSpace initialization order
Josh Stone [Tue, 14 Jan 2014 22:14:39 +0000 (14:14 -0800)]
Fix AddressSpace initialization order

5 years agoFix another unused parameter
Josh Stone [Tue, 14 Jan 2014 22:14:22 +0000 (14:14 -0800)]
Fix another unused parameter

5 years agoBetter warning fix for unused parameters
Josh Stone [Tue, 14 Jan 2014 22:12:10 +0000 (14:12 -0800)]
Better warning fix for unused parameters

Commit f284f869b0b4 turned unused parameters into unused "dummy"
variables, which gcc 4.8 still warns about.  Using the parameter in a
void expression is a more reliable workaround.

5 years agoFix to handleCondDirExits
Emily Jacobson [Tue, 14 Jan 2014 17:03:16 +0000 (11:03 -0600)]
Fix to handleCondDirExits

5 years agoRemoved nonexistent API call in ParseAPI::Block documentation
Emily Jacobson [Thu, 9 Jan 2014 17:53:44 +0000 (11:53 -0600)]
Removed nonexistent API call in ParseAPI::Block documentation

5 years agoFinish the plumbing to ensure that added libraries including the RTlib get DT_NEEDED...
Bill Williams [Mon, 13 Jan 2014 20:14:43 +0000 (14:14 -0600)]
Finish the plumbing to ensure that added libraries including the RTlib get DT_NEEDED = SONAME.

5 years agoWarning fix
Bill Williams [Mon, 13 Jan 2014 19:08:24 +0000 (13:08 -0600)]
Warning fix

5 years agoBuild fix
Bill Williams [Mon, 13 Jan 2014 19:08:17 +0000 (13:08 -0600)]
Build fix

5 years agofileName() returns SONAME if present now, for proper DT_NEEDED updates when rewriting
Bill Williams [Fri, 10 Jan 2014 23:08:12 +0000 (17:08 -0600)]
fileName() returns SONAME if present now, for proper DT_NEEDED updates when rewriting

5 years agoRe-transpose arguments, because CMake 2.6 is dumb
Bill Williams [Fri, 10 Jan 2014 23:07:33 +0000 (17:07 -0600)]
Re-transpose arguments, because CMake 2.6 is dumb

5 years agoProper fix for building RTlib under CMake 2.6
Bill Williams [Fri, 10 Jan 2014 19:06:35 +0000 (13:06 -0600)]
Proper fix for building RTlib under CMake 2.6

5 years agoTwo more CMake 2.6 fixes: proper order of arguments, and only use LINK_PRIVATE where...
Bill Williams [Thu, 9 Jan 2014 21:34:21 +0000 (15:34 -0600)]
Two more CMake 2.6 fixes: proper order of arguments, and only use LINK_PRIVATE where it's supported.

5 years agoFixed a CMake 2.6 bug where it wouldn't recognize libdwarf_imp as a target (and thus...
Bill Williams [Thu, 9 Jan 2014 16:44:21 +0000 (10:44 -0600)]
Fixed a CMake 2.6 bug where it wouldn't recognize libdwarf_imp as a target (and thus wouldn't add a libelf_imp dependency) if we weren't building our own libdwarf. Also cleaned up indentation (as in, it exists now in these CMake files).

5 years agoIncrease BG/Q attach timeout to five minutes.
Matthew LeGendre [Tue, 7 Jan 2014 20:33:30 +0000 (12:33 -0800)]
Increase BG/Q attach timeout to five minutes.

5 years agoMerge branch 'master' of git.dyninst.org:/pub/dyninst
Matthew LeGendre [Tue, 7 Jan 2014 18:31:01 +0000 (10:31 -0800)]
Merge branch 'master' of git.dyninst.org:/pub/dyninst

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

5 years agoChange __FILE__ to FILE__ prints in stackwalker to shorten logs
Matthew LeGendre [Tue, 7 Jan 2014 18:28:50 +0000 (10:28 -0800)]
Change __FILE__ to FILE__ prints in stackwalker to shorten logs

5 years agoFix PC/BGQ crashes on attach timeout
Matthew LeGendre [Tue, 7 Jan 2014 18:28:07 +0000 (10:28 -0800)]
Fix PC/BGQ crashes on attach timeout

5 years agoImplement PC memory usage interface on BGQ
Matthew LeGendre [Tue, 7 Jan 2014 18:26:27 +0000 (10:26 -0800)]
Implement PC memory usage interface on BGQ

5 years agoFix issue with optimization options not being used in RT library build
Matthew LeGendre [Tue, 7 Jan 2014 18:19:20 +0000 (10:19 -0800)]
Fix issue with optimization options not being used in RT library build

5 years agoWIP for testing: properly track springboard locations persistently and per-process...
Bill Williams [Mon, 6 Jan 2014 18:56:30 +0000 (12:56 -0600)]
WIP for testing: properly track springboard locations persistently and per-process, rather than only persistent tracking of traps, globally

5 years agoClean up proccontrol debugging prints. We now print base filenames rather than full...
Matthew LeGendre [Fri, 20 Dec 2013 18:31:46 +0000 (10:31 -0800)]
Clean up proccontrol debugging prints.  We now print base filenames rather than full paths in printfs

5 years agoClean RT library cmake cache before configuring to work around cmake bug where re...
Matthew LeGendre [Fri, 20 Dec 2013 18:31:09 +0000 (10:31 -0800)]
Clean RT library cmake cache before configuring to work around cmake bug where re-running cmake forgets the CMAKE_INSTALL_PREFIX

5 years agoFix procset iterator: we can't necessarily initialize the container from NULL. Had...
Bill Williams [Thu, 19 Dec 2013 17:37:52 +0000 (11:37 -0600)]
Fix procset iterator: we can't necessarily initialize the container from NULL. Had better be able to default-construct it though.

5 years agosymtabAPI: Trim AObject and Object constructors.
Josh Stone [Wed, 18 Dec 2013 00:50:58 +0000 (16:50 -0800)]
symtabAPI: Trim AObject and Object constructors.

Neither of these classes should ever be copied, so declare the standard
copy constructors as private, without implementation; operator= as well.
Remove a few other unimplemented constructors too.

Note: The updates to Object-nt were made by inspection only and should
be checked.  Object-coff and Object-xcoff were already using obsolete
AObject constructors; if dead they should be considered for removal.

5 years agoInitialize thrd in a new FrameNode ctor
Josh Stone [Sat, 14 Dec 2013 02:31:02 +0000 (18:31 -0800)]
Initialize thrd in a new FrameNode ctor

Reported by Coverity as UNINIT_CTOR.

5 years agoInitialize and free PSetFeatures::memset
Josh Stone [Sat, 14 Dec 2013 02:26:20 +0000 (18:26 -0800)]
Initialize and free PSetFeatures::memset

Reported by Coverity as UNINIT_CTOR

5 years agostackwalk: convert some stderr chatter to sw_printf
Josh Stone [Fri, 6 Dec 2013 19:32:46 +0000 (11:32 -0800)]
stackwalk: convert some stderr chatter to sw_printf

5 years agosymtabAPI: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:56:55 +0000 (10:56 -0800)]
symtabAPI: Fix Coverity UNINIT_CTOR errors

5 years agosymlite: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:56:46 +0000 (10:56 -0800)]
symlite: Fix Coverity UNINIT_CTOR errors

5 years agostackwalk: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:56:37 +0000 (10:56 -0800)]
stackwalk: Fix Coverity UNINIT_CTOR errors

5 years agoproccontrol: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:56:24 +0000 (10:56 -0800)]
proccontrol: Fix Coverity UNINIT_CTOR errors

5 years agoparseAPI: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:56:11 +0000 (10:56 -0800)]
parseAPI: Fix Coverity UNINIT_CTOR errors

5 years agoinstructionAPI: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:55:53 +0000 (10:55 -0800)]
instructionAPI: Fix Coverity UNINIT_CTOR errors

5 years agoelf: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:55:40 +0000 (10:55 -0800)]
elf: Fix Coverity UNINIT_CTOR errors

5 years agodataflowAPI: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:55:31 +0000 (10:55 -0800)]
dataflowAPI: Fix Coverity UNINIT_CTOR errors

5 years agocommon: Fix Coverity UNINIT_CTOR errors
Josh Stone [Fri, 6 Dec 2013 18:54:58 +0000 (10:54 -0800)]
common: Fix Coverity UNINIT_CTOR errors

5 years agoUse 'delete' for objects created with 'new'
Josh Stone [Wed, 4 Dec 2013 00:58:45 +0000 (16:58 -0800)]
Use 'delete' for objects created with 'new'

These two instances were incorrectly using free().

Reported by clang-analyzer as Memory Error : Bad deallocator.

5 years agoFix accidental switch fallthrough
Josh Stone [Fri, 22 Nov 2013 20:13:59 +0000 (12:13 -0800)]
Fix accidental switch fallthrough

These were reported by Coverity as MISSING_BREAK, and it seems true -
they should not be falling through to the next case.  Add breaks.

5 years agoAnnotate intentional switch fallthrough
Josh Stone [Fri, 22 Nov 2013 20:11:30 +0000 (12:11 -0800)]
Annotate intentional switch fallthrough

These were reported by Coverity as MISSING_BREAK, but they're
intentionally falling through to the next case.  Coverity will infer
this intent if there's a comment in the last line instead of a break.

5 years agoReimplement Linux P_copy with fstream
Josh Stone [Fri, 22 Nov 2013 19:18:11 +0000 (11:18 -0800)]
Reimplement Linux P_copy with fstream

Coverity reported RESOURCE_LEAK for the fds on error paths, and I see it
also doesn't check write() return value.  It's much easier to just let
fstream do the buffer management and IO.

Note: P_copy doesn't appear to actually be used anywhere, and the former
destination mode 0 was also suspicious.  Maybe it should be removed.

5 years agoReimplement getLinuxMaps in real C++
Josh Stone [Fri, 22 Nov 2013 02:44:37 +0000 (18:44 -0800)]
Reimplement getLinuxMaps in real C++

Coverity reported a few OVERFLOW weaknesses in the previous buffer-happy
code.  The whole function is much simpler using fstream to read maps.

5 years agoemitElf: Fix possible sign-extension errors
Josh Stone [Fri, 22 Nov 2013 00:56:36 +0000 (16:56 -0800)]
emitElf: Fix possible sign-extension errors

When you have an expression type "<uint64_t> = <uint16_t> * <uint16_t>",
it sadly takes a detour into signed values.  The operands will be
promoted to int, then multiplied, then sign-extended to finally fill
uint64_t.  If the multiplication result is greater than 0x7fffffff,
overflowing int, then the top 32 bits of the uint64_t will all be 1s.
(That's if the compiler doesn't blow up the int overflow as undefined.)

The easiest solution is to forcefully promote the operands to the target
size and sign before multiplying.

Reported by Coverity as SIGN_EXTENSION.

5 years agostackwalk: Don't leak CallChecker instances
Josh Stone [Fri, 22 Nov 2013 00:28:01 +0000 (16:28 -0800)]
stackwalk: Don't leak CallChecker instances

Both AnalysisStepperImpl and WandererHelper create CallCheckers in their
constructors, so they should delete in their deconstructors.

Reported by Coverity as CTOR_DTOR_LEAK.

5 years agoproccontrol: Flatten up_notify as a member of int_notify
Josh Stone [Thu, 21 Nov 2013 23:53:04 +0000 (15:53 -0800)]
proccontrol: Flatten up_notify as a member of int_notify

In the int_notify ctor, up_notify is newed, but this member is never
deleted.  Since this object never changes, it doesn't need to be a
pointer at all, so make it a direct member.

However, int_notify is a singleton that's never deleted, so the overall
leakiness isn't really changed here.

Reported by Coverity as CTOR_DTOR_LEAK.

5 years agosymlite: Use pread rather than lseek save/restore
Josh Stone [Thu, 21 Nov 2013 23:34:44 +0000 (15:34 -0800)]
symlite: Use pread rather than lseek save/restore

In SymLite::getInterpreterName, it was doing a SEEK_CUR, SEEK_SET,
read(), then SEEK_SET back to the original offset.  This can all be
replaced by using pread() to read from any offset without affecting the
actual file offset.

The former lseeks triggered Coverity CHECKED_RETURN & NEGATIVE_RETURNS.

5 years agocommon: Fix a sizeof error in calloc/realloc
Josh Stone [Thu, 21 Nov 2013 04:37:44 +0000 (20:37 -0800)]
common: Fix a sizeof error in calloc/realloc

An allocation resulting in (anno_list_t*) should not use the pointer
size, but rather sizeof(anno_list_t).  It just happened to be harmless
here because anno_list_t is itself typedef void*, so the same size.

Reported by Coverity as SIZEOF_MISMATCH.

5 years agopatchAPI: Remove 'during' before destroying it
Josh Stone [Thu, 21 Nov 2013 01:01:55 +0000 (17:01 -0800)]
patchAPI: Remove 'during' before destroying it

In PatchParseCallback::remove_edge_cb, if it has pe->points_.during,
then this is both destroyed and removed from PatchFunctions.  However,
PatchCallback::destroy will delete the point if not batching, and
PatchFunction::remove dereferences it, so destroy must come after.

Reported by Coverity as USE_AFTER_FREE.

5 years agoproccontrol: Avoid dereferencing a deleted 'this'
Josh Stone [Thu, 21 Nov 2013 00:55:09 +0000 (16:55 -0800)]
proccontrol: Avoid dereferencing a deleted 'this'

In linux_process::preTerminate, a debug message asking, "Is this irony?"
has its own irony by calling getPid() when 'this' was just deleted.

Reported by Coverity as USE_AFTER_FREE.

5 years agosymlite: Don't use a delete pointer
Josh Stone [Thu, 21 Nov 2013 00:47:44 +0000 (16:47 -0800)]
symlite: Don't use a delete pointer

In SymElfFactory::closeSymbolReader, if 'ser' isn't in open_symelfs,
then it is deleted, so the function should return without using 'ser'
any more.

Reported by Coverity as USE_AFTER_FREE.

5 years agoproccontrol: Fix a copy-paste typo in ppc_process::readInsnForSS
Josh Stone [Thu, 21 Nov 2013 00:18:56 +0000 (16:18 -0800)]
proccontrol: Fix a copy-paste typo in ppc_process::readInsnForSS

After iterating over all of map mm_for_ss, this function will create a
new mem_response for the request.  If that reports isReady() right away,
then the memcpy incorrectly copies from the previous map iterator, which
is now exhausted (==end()).  This appears to be a copy-paste typo of the
memcpy from within the for loop, and this memcpy should use new_resp.

Reported by Coverity as INVALIDATE_ITERATOR.

5 years agoelf: Fix iteration in the destructor
Josh Stone [Thu, 21 Nov 2013 00:10:47 +0000 (16:10 -0800)]
elf: Fix iteration in the destructor

In Elf_X::~Elf_X, the loop over elf_x_by_fd returns after it finds an
erases its element.  The loop over elf_x_by_ptr should do the same.
It's actually an error to continue the for loop with ++iter, because
map::erase() invalidates its iterator.

Reported by Coverity as INVALIDATE_ITERATOR.

5 years agoAssert that dwarf_loclist_from_expr_a returns cnt==1
Josh Stone [Wed, 20 Nov 2013 23:49:33 +0000 (15:49 -0800)]
Assert that dwarf_loclist_from_expr_a returns cnt==1

Coverity reports ARRAY_VS_SINGLETON in DwarfWalker::decodeExpression,
because the address of a singleton, &descs, is passed with cnt to
decodeLocationListForStaticOffsetOrAddress, which treats it as an array.
Without knowledge of cnt, the analyzer thinks this could be source of
memory corruption.

In fact, dwarf_loclist_from_expr_a always sets listlen (cnt) to 1 on
success.  If we assert this, then the analyzer can tell that the
singleton "array" bound is fine.

5 years agodataflowAPI: Correct an assertion test
Josh Stone [Wed, 20 Nov 2013 23:02:05 +0000 (15:02 -0800)]
dataflowAPI: Correct an assertion test

Based on surrounding context, it seems clear that this assert meant to
test equality, not the result of assignment.

Reported by Coverity as ASSERT_SIDE_EFFECT.

5 years agoWe were double-adding field sizes to structs when they came from DWARF. This fixes...
Bill Williams [Fri, 13 Dec 2013 22:27:59 +0000 (16:27 -0600)]
We were double-adding field sizes to structs when they came from DWARF. This fixes that; we still need to add field sizes in cases where users create their own data types.

5 years agoIndirect tail calls shouldn't count as unresolved control flow for instrumentation...
Bill Williams [Fri, 13 Dec 2013 20:33:25 +0000 (14:33 -0600)]
Indirect tail calls shouldn't count as unresolved control flow for instrumentation purposes.

5 years agoAssorted bugfixes: don't die on DW_OP_piece, remove unimplemented stream operators...
Bill Williams [Fri, 13 Dec 2013 17:11:00 +0000 (11:11 -0600)]
Assorted bugfixes: don't die on DW_OP_piece, remove unimplemented stream operators from headers, bug fix for indirect tail calls, treat indirect symbols as functions in our aggregates, and handle DW_FORM_sec_offset.

5 years agoFixes for three bugs: tie CMake version dependency to use of the relevant features...
William Williams [Thu, 12 Dec 2013 17:06:45 +0000 (09:06 -0800)]
Fixes for three bugs: tie CMake version dependency to use of the relevant features, check types for compatibility not pointer equality, and don't apply tail call heuristics to call instructions.

5 years agoMerge branch 'master' into pc_mem_stats
Matthew LeGendre [Wed, 11 Dec 2013 18:50:22 +0000 (10:50 -0800)]
Merge branch 'master' into pc_mem_stats

5 years agoFix installation issues from RT library cmake split
Matthew LeGendre [Wed, 11 Dec 2013 18:49:17 +0000 (10:49 -0800)]
Fix installation issues from RT library cmake split

5 years agoDo include <linux/ptrace.h> for glibc prior to 2.7
Josh Stone [Thu, 28 Nov 2013 01:10:14 +0000 (17:10 -0800)]
Do include <linux/ptrace.h> for glibc prior to 2.7

5 years agoRefactor RT library into separate CMake project so we can change compilers
Matthew LeGendre [Wed, 27 Nov 2013 00:00:35 +0000 (16:00 -0800)]
Refactor RT library into separate CMake project so we can change compilers

5 years agoDefault to libiberty demangler
Matthew LeGendre [Tue, 26 Nov 2013 17:53:13 +0000 (09:53 -0800)]
Default to libiberty demangler

5 years agoEnable built-in gcc demangler rather than libiberty's
Matthew LeGendre [Mon, 25 Nov 2013 21:08:39 +0000 (13:08 -0800)]
Enable built-in gcc demangler rather than libiberty's

5 years agoJust include <sys/ptrace.h>
William Cohen [Mon, 5 Aug 2013 16:24:36 +0000 (12:24 -0400)]
Just include <sys/ptrace.h>

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=991889

5 years agoMerge branch 'clang-warnings'
Josh Stone [Fri, 22 Nov 2013 20:31:09 +0000 (12:31 -0800)]
Merge branch 'clang-warnings'

5 years agoPostponedSyscall fixes
Matthew LeGendre [Wed, 13 Nov 2013 23:38:31 +0000 (15:38 -0800)]
PostponedSyscall fixes

5 years agoBuild downloaded packages in build dir rather than source dir. Prevents conflicts...
Matthew LeGendre [Wed, 20 Nov 2013 17:44:49 +0000 (09:44 -0800)]
Build downloaded packages in build dir rather than source dir.  Prevents conflicts when sharing source tree between platforms.

5 years agoFix an error message Address formatting [-Wstring-plus-int]
Josh Stone [Wed, 20 Nov 2013 01:15:26 +0000 (17:15 -0800)]
Fix an error message Address formatting [-Wstring-plus-int]

5 years agoRemove extra parentheses for plain conditions [-Wparentheses-equality]
Josh Stone [Wed, 20 Nov 2013 01:04:12 +0000 (17:04 -0800)]
Remove extra parentheses for plain conditions [-Wparentheses-equality]

5 years agoAdd extra parentheses for assignment-as-condition [-Wparentheses]
Josh Stone [Wed, 20 Nov 2013 01:02:36 +0000 (17:02 -0800)]
Add extra parentheses for assignment-as-condition  [-Wparentheses]

5 years agoConvince Clang that it's possible for an EdgeTypeEnum to be -1
Josh Stone [Wed, 20 Nov 2013 00:55:16 +0000 (16:55 -0800)]
Convince Clang that it's possible for an EdgeTypeEnum to be -1

[-Wtautological-constant-out-of-range-compare]

5 years agoFix NULLs returned to bools [-Wnull-conversion]
Josh Stone [Wed, 20 Nov 2013 00:44:27 +0000 (16:44 -0800)]
Fix NULLs returned to bools [-Wnull-conversion]

5 years agoExpand SW calltree interface to allow expanding and modifying CallTree. Needed for...
Matthew LeGendre [Wed, 20 Nov 2013 00:39:37 +0000 (16:39 -0800)]
Expand SW calltree interface to allow expanding and modifying CallTree.  Needed for STAT.

5 years agoPPC64 build fix for SymtabAPI
Matthew LeGendre [Wed, 20 Nov 2013 00:39:02 +0000 (16:39 -0800)]
PPC64 build fix for SymtabAPI

5 years agoNew PC PlatFeature interface for querying process memory usage. Implemented on BGQ...
Matthew LeGendre [Wed, 20 Nov 2013 00:38:48 +0000 (16:38 -0800)]
New PC PlatFeature interface for querying process memory usage.  Implemented on BGQ and Linux

5 years agoHide sometimes-unused functions better [-Wunused-function]
Josh Stone [Wed, 20 Nov 2013 00:38:18 +0000 (16:38 -0800)]
Hide sometimes-unused functions better [-Wunused-function]

- Mark ParserDetails.h is_code() static inline, so compilation units
  which don't call it will just ignore it.

- Only define aix_region_hack() if define(os_aix).

5 years agoFix issue where we were using the wrong BGQ compiler for the RT library
Matthew LeGendre [Wed, 20 Nov 2013 00:36:10 +0000 (16:36 -0800)]
Fix issue where we were using the wrong BGQ compiler for the RT library

5 years agoFix BGQ build error in RT library
Matthew LeGendre [Wed, 20 Nov 2013 00:35:42 +0000 (16:35 -0800)]
Fix BGQ build error in RT library

5 years agoRemove unused data members [-Wunused-private-field]
Josh Stone [Wed, 20 Nov 2013 00:33:16 +0000 (16:33 -0800)]
Remove unused data members [-Wunused-private-field]

5 years agoUse (void) to squash unused variables [-Wself-assign]
Josh Stone [Wed, 20 Nov 2013 00:00:57 +0000 (16:00 -0800)]
Use (void) to squash unused variables [-Wself-assign]

Clang complains about the previous code:

  warning: explicitly assigning a variable [...] to itself

5 years agofindProcLWPs: initialize lwp_ppid [-Wsometimes-uninitialized]
Josh Stone [Tue, 19 Nov 2013 23:58:12 +0000 (15:58 -0800)]
findProcLWPs: initialize lwp_ppid [-Wsometimes-uninitialized]

5 years agoSeparate unclear "=-" into "= -"
Josh Stone [Tue, 19 Nov 2013 23:50:59 +0000 (15:50 -0800)]
Separate unclear "=-" into "= -"

These gave clang cause for concern, like:

  warning: use of unary operator that may be intended as
  compound assignment (-=)

I believe they really are just meant to assign negative values.

5 years agoFix string termination [-Wnon-literal-null-conversion]
Josh Stone [Tue, 19 Nov 2013 23:46:44 +0000 (15:46 -0800)]
Fix string termination [-Wnon-literal-null-conversion]

These two lines were setting their pointers to '\0', effectively NULL,
rather than writing the value pointed to.

5 years agoReconcile class/struct declarations [-Wmismatched-tags]
Josh Stone [Tue, 19 Nov 2013 23:41:33 +0000 (15:41 -0800)]
Reconcile class/struct declarations [-Wmismatched-tags]

5 years agoLet Dyninst itself be compiled with Clang on Linux
Josh Stone [Tue, 19 Nov 2013 22:41:42 +0000 (14:41 -0800)]
Let Dyninst itself be compiled with Clang on Linux

With clang-3.3-0.10.rc3.fc19.x86_64 and libstdc++-4.8.2-1.fc19.x86_64,
the fixes required were as follows:

- cmake files looking for CMAKE_COMPILER_IS_GNUCXX need to also
  recognize CMAKE_CXX_COMPILER_ID "Clang".

- The ListHash macro had a pointer->int cast that halted Clang.

- Several templates in rose/*InstructionSemantics.h couldn't be resolved
  implicitly; they're now either made explicit or converted to typename.

- ppc32::cr0.val() is apparently not const enough for Clang as a
  template parameter; changed to ppc32::icr0.

5 years agocommon: Use __GLIBCXX__ for libstdc++ checks
Josh Stone [Tue, 19 Nov 2013 22:26:10 +0000 (14:26 -0800)]
common: Use __GLIBCXX__ for libstdc++ checks

A Dyninst client might choose to compile with Clang and libstdc++.
Clang does set __GNUC__ macros, but only as if it were GCC 4.2.1, which
means checks looking for libstdc++ features were misled.  Those checks
are better served by __GLIBCXX__, which is a unique date stamp for each
GCC release.

6 years agodyninstAPI: Remove syscall instrumentation on detach
Josh Stone [Sat, 9 Nov 2013 01:09:24 +0000 (17:09 -0800)]
dyninstAPI: Remove syscall instrumentation on detach

During PCProcess::bootstrapProcess(), many syscalls are instrumented,
which may involve DyninstAPI_RT breakpoints.  If the mutator later
detaches, then there's no one to catch the instrumentation signal, so
the detached mutatee will crash.

With this patch, PCProcess will remove its syscall instrumentation
points when the mutator detaches.  It's still up to mutators to remove
their own instrumentation when desired.

Reported-by: Zifei Tong <soariez@gmail.com>
Signed-off-by: Josh Stone <jistone@redhat.com>