Fix a bunch of misc warnings.
[ 8%] Building CXX object common/CMakeFiles/common.dir/src/arch-aarch64.C.o
/home/peter/dyninst/common/src/arch-aarch64.C:111:45: warning: unused parameter âptrâ [-Wunused-parameter]
void instruction::setInstruction(codeBuf_t *ptr, Address) {
^
/home/peter/dyninst/common/src/arch-aarch64.C:143:40: warning: unused parameter âfromâ [-Wunused-parameter]
unsigned instruction::jumpSize(Address from, Address to, unsigned addr_width) {
^
/home/peter/dyninst/common/src/arch-aarch64.C:143:54: warning: unused parameter âtoâ [-Wunused-parameter]
unsigned instruction::jumpSize(Address from, Address to, unsigned addr_width) {
^
/home/peter/dyninst/common/src/arch-aarch64.C:143:67: warning: unused parameter âaddr_widthâ [-Wunused-parameter]
unsigned instruction::jumpSize(Address from, Address to, unsigned addr_width) {
^
/home/peter/dyninst/common/src/arch-aarch64.C:149:40: warning: unused parameter âdispâ [-Wunused-parameter]
unsigned instruction::jumpSize(Address disp, unsigned addr_width) {
^
/home/peter/dyninst/common/src/arch-aarch64.C:149:55: warning: unused parameter âaddr_widthâ [-Wunused-parameter]
unsigned instruction::jumpSize(Address disp, unsigned addr_width) {
^
In file included from /home/peter/dyninst/common/h/dyn_regs.h:38:0,
from /home/peter/dyninst/common/h/dyntypes.h:170,
from /home/peter/dyninst/common/src/Types.h:168,
from /home/peter/dyninst/common/src/arch-aarch64.C:31:
/home/peter/dyninst/common/src/arch-aarch64.C: In member function âunsigned int NS_aarch64::instruction::getBranchTargetReg() constâ:
/home/peter/dyninst/common/src/arch-aarch64.C:204:24: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
assert( regNum >= 0 || regNum <= 30);
^
[ 14%] Building CXX object symtabAPI/CMakeFiles/symtabAPI.dir/src/Function.C.o
/home/peter/dyninst/symtabAPI/src/Function.C:54:36: warning: unused parameter âsymâ [-Wunused-parameter]
FunctionBase::FunctionBase(Symbol *sym) :
^
/home/peter/dyninst/symtabAPI/src/Function.C:76:36: warning: unused parameter âmâ [-Wunused-parameter]
FunctionBase::FunctionBase(Module *m) :
^
/home/peter/dyninst/symtabAPI/src/Function.C:475:61: warning: unused parameter âisPrimaryâ [-Wunused-parameter]
bool InlinedFunction::addMangledName(std::string name, bool isPrimary)
^
/home/peter/dyninst/symtabAPI/src/Function.C:481:60: warning: unused parameter âisPrimaryâ [-Wunused-parameter]
bool InlinedFunction::addPrettyName(std::string name, bool isPrimary)
^
[ 22%] Building CXX object symtabAPI/CMakeFiles/symtabAPI.dir/src/dwarfWalker.C.o
In file included from /home/peter/dyninst/symtabAPI/src/dwarfWalker.C:31:0:
/home/peter/dyninst/symtabAPI/src/dwarfWalker.h: In constructor âDyninst::SymtabAPI::DwarfWalker::DwarfWalker(Dyninst::SymtabAPI::Symtab*, Dwarf_Debug_s*&)â:
/home/peter/dyninst/symtabAPI/src/dwarfWalker.h:314:14: warning: âDyninst::SymtabAPI::DwarfWalker::compile_offsetâ will be initialized after [-Wreorder]
Dwarf_Off compile_offset;
^
/home/peter/dyninst/symtabAPI/src/dwarfWalker.h:292:12: warning: âchar** Dyninst::SymtabAPI::DwarfWalker::srcFileList_â [-Wreorder]
char** srcFileList_;
^
/home/peter/dyninst/symtabAPI/src/dwarfWalker.C:76:1: warning: when initialized here [-Wreorder]
DwarfWalker::DwarfWalker(Symtab *symtab, Dwarf_Debug &dbg)
^
[ 22%] Building CXX object symtabAPI/CMakeFiles/symtabAPI.dir/src/emitElf-64.C.o
/home/peter/dyninst/symtabAPI/src/emitElf-64.C: In member function âbool Dyninst::SymtabAPI::emitElf64<ElfTypes>::driver(std::string) [with ElfTypes = Dyninst::SymtabAPI::ElfTypes32; std::string = std::basic_string<char>]â:
/home/peter/dyninst/symtabAPI/src/emitElf-64.C:868:9: warning: ignoring return value of âssize_t write(int, const void*, size_t)â, declared with attribute warn_unused_result [-Wunused-result]
write(newfd, &offset, sizeof(Elf_Off));
^
/home/peter/dyninst/symtabAPI/src/emitElf-64.C: In member function âbool Dyninst::SymtabAPI::emitElf64<ElfTypes>::driver(std::string) [with ElfTypes = Dyninst::SymtabAPI::ElfTypes64; std::string = std::basic_string<char>]â:
/home/peter/dyninst/symtabAPI/src/emitElf-64.C:868:9: warning: ignoring return value of âssize_t write(int, const void*, size_t)â, declared with attribute warn_unused_result [-Wunused-result]
[ 26%] Building CXX object instructionAPI/CMakeFiles/instructionAPI.dir/src/InstructionDecoder-x86.C.o
/home/peter/dyninst/instructionAPI/src/InstructionDecoder-x86.C: In member function âbool Dyninst::InstructionAPI::InstructionDecoder_x86::decodeOneOperand(const Dyninst::InstructionAPI::InstructionDecoder::buffer&, const NS_x86::ia32_operand&, int&, const Dyninst::InstructionAPI::Instruction*, bool, bool)â:
/home/peter/dyninst/instructionAPI/src/InstructionDecoder-x86.C:795:12: warning: variable âhas_vexâ set but not used [-Wunused-but-set-variable]
bool has_vex = 0;
^
[ 27%] Building CXX object instructionAPI/CMakeFiles/instructionAPI.dir/src/InstructionDecoder-aarch64.C.o
In file included from /home/peter/dyninst/instructionAPI/src/InstructionDecoder-aarch64.C:31:0:
/home/peter/dyninst/instructionAPI/src/InstructionDecoder-aarch64.h: In constructor âDyninst::InstructionAPI::InstructionDecoder_aarch64::InstructionDecoder_aarch64(Dyninst::Architecture)â:
/home/peter/dyninst/instructionAPI/src/InstructionDecoder-aarch64.h:387:30: warning: âDyninst::InstructionAPI::InstructionDecoder_aarch64::_Qâ will be initialized after [-Wreorder]
unsigned int _Q;
^
/home/peter/dyninst/instructionAPI/src/InstructionDecoder-aarch64.h:239:31: warning: âint Dyninst::InstructionAPI::InstructionDecoder_aarch64::sizeâ [-Wreorder]
int _szField, size;
^
/home/peter/dyninst/instructionAPI/src/InstructionDecoder-aarch64.C:141:5: warning: when initialized here [-Wreorder]
InstructionDecoder_aarch64::InstructionDecoder_aarch64(Architecture a)
^
/home/peter/dyninst/instructionAPI/src/InstructionDecoder-aarch64.C: In member function âDyninst::InstructionAPI::Expression::Ptr Dyninst::InstructionAPI::InstructionDecoder_aarch64::makeMemRefIndexLiteral()â:
/home/peter/dyninst/instructionAPI/src/InstructionDecoder-aarch64.C:1086:85: warning: ârtâ may be used uninitialized in this function [-Wmaybe-uninitialized]
return makeDereferenceExpression(makeAddExpression(makePCExpr(), label, u64), rt);
^
[ 27%] Building CXX object parseAPI/CMakeFiles/parseAPI.dir/src/Parser.C.o
/home/peter/dyninst/parseAPI/src/Parser.C: In member function âvoid Dyninst::ParseAPI::Parser::parse_frame(Dyninst::ParseAPI::ParseFrame&, bool)â:
/home/peter/dyninst/parseAPI/src/Parser.C:888:20: warning: variable âceâ set but not used [-Wunused-but-set-variable]
Edge * ce = NULL;
^
[ 32%] Building CXX object parseAPI/CMakeFiles/parseAPI.dir/src/IA_aarch64Details.C.o
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:111:59: warning: unused parameter âblockToCheckâ [-Wunused-parameter]
bool IA_aarch64Details::findTableAddrNoTOC(const IA_IAPI* blockToCheck)
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:136:33: warning: unused parameter âeâ [-Wunused-parameter]
void processPredecessor(Edge* e, std::set<Block*>& visited, std::deque<Block*>& worklist)
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:136:54: warning: unused parameter âvisitedâ [-Wunused-parameter]
void processPredecessor(Edge* e, std::set<Block*>& visited, std::deque<Block*>& worklist)
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:136:83: warning: unused parameter âworklistâ [-Wunused-parameter]
void processPredecessor(Edge* e, std::set<Block*>& visited, std::deque<Block*>& worklist)
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:142:81: warning: unused parameter âstartâ [-Wunused-parameter]
bool IA_aarch64Details::scanForAdjustOrBase(IA_IAPI::allInsns_t::const_iterator start,
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:143:44: warning: unused parameter âendâ [-Wunused-parameter]
IA_IAPI::allInsns_t::const_iterator end,
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:144:26: warning: unused parameter âjumpAddrRegâ [-Wunused-parameter]
RegisterAST::Ptr &jumpAddrReg) {
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:150:75: warning: unused parameter âstartâ [-Wunused-parameter]
bool IA_aarch64Details::findTableBase(IA_IAPI::allInsns_t::const_iterator start,
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:151:45: warning: unused parameter âendâ [-Wunused-parameter]
IA_IAPI::allInsns_t::const_iterator end) {
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:159:47: warning: unused parameter âcurrBlkâ [-Wunused-parameter]
bool IA_aarch64Details::parseJumpTable(Block* currBlk,
^
/home/peter/dyninst/parseAPI/src/IA_aarch64Details.C:160:59: warning: unused parameter âoutEdgesâ [-Wunused-parameter]
std::vector<std::pair< Address, EdgeTypeEnum> >& outEdges)
^
[ 33%] Building CXX object parseAPI/CMakeFiles/parseAPI.dir/src/BoundFactData.C.o
/home/peter/dyninst/parseAPI/src/BoundFactData.C:604:39: warning: unused parameter âbâ [-Wunused-parameter]
static bool IsInReadOnlyRegion(Block *b, Address low, Address high) {
^
[ 54%] Building CXX object proccontrol/CMakeFiles/pcontrol.dir/src/loadLibrary/codegen-aarch64.C.o
/home/peter/dyninst/proccontrol/src/loadLibrary/codegen-aarch64.C: In member function âbool Dyninst::ProcControlAPI::Codegen::generateCallAARCH64(Dyninst::Address, const std::vector<long unsigned int>&)â:
/home/peter/dyninst/proccontrol/src/loadLibrary/codegen-aarch64.C:53:10: warning: unused variable âblr_bufâ [-Wunused-variable]
char blr_buf[] = {
^
[ 56%] Building CXX object proccontrol/CMakeFiles/pcontrol.dir/src/mmapalloc.C.o
/home/peter/dyninst/proccontrol/src/mmapalloc.C: In member function âvirtual bool mmap_alloc_process::plat_createAllocationSnippet(Dyninst::Address, bool, long unsigned int, void*&, long unsigned int&, long unsigned int&)â:
/home/peter/dyninst/proccontrol/src/mmapalloc.C:597:22: warning: variable âaddr_sizeâ set but not used [-Wunused-but-set-variable]
unsigned int addr_size;
^
[ 56%] Building CXX object proccontrol/CMakeFiles/pcontrol.dir/src/linux.C.o
In file included from /home/peter/dyninst/proccontrol/src/linux.C:48:0:
/home/peter/dyninst/proccontrol/src/linux.C: In member function âvirtual bool DecoderLinux::decode(Dyninst::ProcControlAPI::ArchEvent*, std::vector<boost::shared_ptr<Dyninst::ProcControlAPI::Event> >&)â:
/home/peter/dyninst/proccontrol/h/PCErrors.h:100:108: warning: format â%pâ expects argument of type âvoid*â, but argument 6 has type âDyninst::MachRegisterVal {aka long unsigned int}â [-Wformat=]
fprintf(pctrl_err_out, "[%s:%u-%s] - Error: " format, FILE__, __LINE__, thrdName(), ## __VA_ARGS__); \
^
/home/peter/dyninst/proccontrol/src/linux.C:341:25: note: in expansion of macro âperr_printfâ
perr_printf("ARM-error: Failed to remove inserted BP, addr %p.\n",
^
/home/peter/dyninst/proccontrol/src/linux.C: In member function âvirtual bool linux_process::plat_attachWillTriggerStop()â:
/home/peter/dyninst/proccontrol/src/linux.C:1144:42: warning: ignoring return value of âint fscanf(FILE*, const char*, ...)â, declared with attribute warn_unused_result [-Wunused-result]
&tmpPid, &tmpPid, &ttyNumber);
^
/home/peter/dyninst/proccontrol/src/linux.C: In member function âbool linux_process::readStatM(long unsigned int&, long unsigned int&, long unsigned int&)â:
/home/peter/dyninst/proccontrol/src/linux.C:1927:35: warning: ignoring return value of âint fscanf(FILE*, const char*, ...)â, declared with attribute warn_unused_result [-Wunused-result]
&text, &lib, &data, &dt);
^
[ 77%] Building CXX object dyninstAPI/CMakeFiles/dyninstAPI.dir/src/function.C.o
/home/peter/dyninst/dyninstAPI/src/function.C: In member function âbool func_instance::createOffsetVector_Symbols()â:
/home/peter/dyninst/dyninstAPI/src/function.C:1205:18: warning: variable âbpâ set but not used [-Wunused-but-set-variable]
MachRegister bp = MachRegister::getFramePointer(arch);
^
/home/peter/dyninst/dyninstAPI/src/function.C: In member function âvoid func_instance::createTMap_internal(StackMod*, StackLocation*, TMap*)â:
/home/peter/dyninst/dyninstAPI/src/function.C:1530:27: warning: variable âsizeâ set but not used [-Wunused-but-set-variable]
StackAnalysis::Height size = loc->size();
^
[ 95%] Building CXX object dyninstAPI/CMakeFiles/dyninstAPI.dir/src/codegen-x86.C.o
/home/peter/dyninst/dyninstAPI/src/codegen-x86.C: In static member function âstatic bool insnCodeGen::modifyDisp(long int, NS_x86::instruction&, codeGen&, Dyninst::Architecture, Dyninst::Address)â:
/home/peter/dyninst/dyninstAPI/src/codegen-x86.C:1394:13: warning: variable âsib_scale_factorâ set but not used [-Wunused-but-set-variable]
int sib_scale_factor;
^
[ 96%] Building CXX object dyninstAPI/CMakeFiles/dyninstAPI.dir/src/linux.C.o
/home/peter/dyninst/dyninstAPI/src/linux.C: In static member function âstatic bool BinaryEdit::getResolvedLibraryPath(const string&, std::vector<std::basic_string<char> >&)â:
/home/peter/dyninst/dyninstAPI/src/linux.C:223:37: warning: ignoring return value of âchar* fgets(char*, int, FILE*)â, declared with attribute warn_unused_result [-Wunused-result]
fgets(buffer, 512, ldconfig); // ignore first line
^
Signed-off-by: Peter Foley <pefoley2@xxxxxxxxxxx>
---
common/src/arch-aarch64.C | 8 +++---
dyninstAPI/src/codegen-x86.C | 10 --------
dyninstAPI/src/function.C | 2 --
dyninstAPI/src/linux.C | 12 +++++----
instructionAPI/CMakeLists.txt | 8 ++++++
instructionAPI/h/Result.h | 3 ++-
instructionAPI/src/InstructionDecoder-aarch64.C | 6 +++--
instructionAPI/src/InstructionDecoder-x86.C | 2 --
parseAPI/src/BoundFactData.C | 18 ++++++--------
parseAPI/src/IA_aarch64Details.C | 18 +++++++-------
parseAPI/src/Parser.C | 3 ---
proccontrol/src/DecoderWindows.C | 1 -
proccontrol/src/linux.C | 27 ++++++++++++--------
proccontrol/src/loadLibrary/codegen-aarch64.C | 2 ++
proccontrol/src/mmapalloc.C | 4 +--
symtabAPI/src/Function.C | 33 ++++---------------------
symtabAPI/src/dwarfWalker.C | 4 +--
symtabAPI/src/emitElf-64.C | 5 +++-
18 files changed, 72 insertions(+), 94 deletions(-)
diff --git a/common/src/arch-aarch64.C b/common/src/arch-aarch64.C
index a73e14a..7f38e68 100644
--- a/common/src/arch-aarch64.C
+++ b/common/src/arch-aarch64.C
@@ -108,7 +108,7 @@ bool instruction::isCall() const
return false;
}
-void instruction::setInstruction(codeBuf_t *ptr, Address) {
+void instruction::setInstruction(codeBuf_t * /*ptr*/, Address) {
assert(0);
}
@@ -140,13 +140,13 @@ bool instruction::isCondBranch() const {
return false;
}
-unsigned instruction::jumpSize(Address from, Address to, unsigned addr_width) {
+unsigned instruction::jumpSize(Address /*from*/, Address /*to*/, unsigned /*addr_width*/) {
assert(0);
return -1;
}
// -1 is infinite, don't ya know.
-unsigned instruction::jumpSize(Address disp, unsigned addr_width) {
+unsigned instruction::jumpSize(Address /*disp*/, unsigned /*addr_width*/) {
assert(0);
return instruction::size();
}
@@ -201,7 +201,7 @@ unsigned instruction::getBranchTargetReg() const{
regNum = GET_OFFSET32(UNCOND_BR.REG)>>2;
// be sure the reg num is in the range
- assert( regNum >= 0 || regNum <= 30);
+ assert(regNum <= 30);
return regNum;
}
diff --git a/dyninstAPI/src/codegen-x86.C b/dyninstAPI/src/codegen-x86.C
index bbc8f87..0cc9a2d 100644
--- a/dyninstAPI/src/codegen-x86.C
+++ b/dyninstAPI/src/codegen-x86.C
@@ -1387,18 +1387,8 @@ bool insnCodeGen::modifyDisp(signed long newDisp, instruction &insn, codeGen &ge
if (modrm_rm == 4) {
unsigned char sib = *origInsn++;
- unsigned char sib_scale = MODRM_MOD(sib);
- //unsigned char sib_index = MODRM_REG(sib);
unsigned char sib_base = MODRM_RM(sib);
- int sib_scale_factor;
- switch((int)sib_scale) {
- case 0: sib_scale_factor = 1; break;
- case 1: sib_scale_factor = 2; break;
- case 2: sib_scale_factor = 4; break;
- case 3: sib_scale_factor = 8; break;
- }
-
// Check for displacement in the SIB
if (sib_base == 5 && modrm_mod == 0) {
origDispSize = 32;
diff --git a/dyninstAPI/src/function.C b/dyninstAPI/src/function.C
index ab6940b..2b2d8ee 100644
--- a/dyninstAPI/src/function.C
+++ b/dyninstAPI/src/function.C
@@ -1202,7 +1202,6 @@ bool func_instance::createOffsetVector_Symbols()
if (!ifunc()->hasNoStackFrame()) {
base -= width; // account for BP save
}
- MachRegister bp = MachRegister::getFramePointer(arch);
for (auto vIter = _vars.begin(); vIter != _vars.end(); ++vIter) {
SymtabAPI::localVar* var = *vIter;
@@ -1527,7 +1526,6 @@ bool func_instance::addToOffsetVector(StackAnalysis::Height off, int size, Stack
void func_instance::createTMap_internal(StackMod* mod, StackLocation* loc, TMap* tMap)
{
StackAnalysis::Height off = loc->off();
- StackAnalysis::Height size = loc->size();
switch(mod->type()) {
case(StackMod::INSERT): {
/* Model:
diff --git a/dyninstAPI/src/linux.C b/dyninstAPI/src/linux.C
index e42a0db..251bffa 100644
--- a/dyninstAPI/src/linux.C
+++ b/dyninstAPI/src/linux.C
@@ -43,6 +43,8 @@
#include "linux.h"
#include <dlfcn.h>
+#include "boost/shared_ptr.hpp"
+
#include "pcEventMuxer.h"
#include "common/src/headers.h"
@@ -176,7 +178,6 @@ bool BinaryEdit::getResolvedLibraryPath(const string &filename, std::vector<stri
char *libPathStr, *libPath;
std::vector<string> libPaths;
struct stat dummy;
- FILE *ldconfig;
char buffer[512];
char *pos, *key, *val;
@@ -218,10 +219,12 @@ bool BinaryEdit::getResolvedLibraryPath(const string &filename, std::vector<stri
}
// search ld.so.cache
- ldconfig = popen("/sbin/ldconfig -p", "r");
+ boost::shared_ptr<FILE> ldconfig(popen("/sbin/ldconfig -p", "r"), pclose);
if (ldconfig) {
- fgets(buffer, 512, ldconfig); // ignore first line
- while (fgets(buffer, 512, ldconfig) != NULL) {
+ if(!fgets(buffer, 512, ldconfig.get())) { // ignore first line
+ return false;
+ }
+ while (fgets(buffer, 512, ldconfig.get()) != NULL) {
pos = buffer;
while (*pos == ' ' || *pos == '\t') pos++;
key = pos;
@@ -237,7 +240,6 @@ bool BinaryEdit::getResolvedLibraryPath(const string &filename, std::vector<stri
paths.push_back(val);
}
}
- pclose(ldconfig);
}
// search hard-coded system paths
diff --git a/instructionAPI/CMakeLists.txt b/instructionAPI/CMakeLists.txt
index 4649e6c..359ff7e 100644
--- a/instructionAPI/CMakeLists.txt
+++ b/instructionAPI/CMakeLists.txt
@@ -23,6 +23,14 @@ set (SRC_LIST
)
SET_SOURCE_FILES_PROPERTIES(${SRC_LIST} PROPERTIES LANGUAGE CXX)
+# Shave 3 minute off of the time it takes to compile this file by falling back to not tracking
+# variables by default, rather then waiting until the variable tracking limit
+# is reached.
+if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+set_source_files_properties(src/InstructionDecoder-aarch64.C PROPERTIES COMPILE_FLAGS
+ -fno-var-tracking-assignments)
+endif()
+
ADD_DEFINITIONS(-DINSTRUCTION_LIB)
dyninst_library(instructionAPI common)
diff --git a/instructionAPI/h/Result.h b/instructionAPI/h/Result.h
index 30ca425..8dd15cc 100644
--- a/instructionAPI/h/Result.h
+++ b/instructionAPI/h/Result.h
@@ -98,7 +98,8 @@ namespace Dyninst
m192,
m256,
m384,
- m512
+ m512,
+ invalid_type
};
template < Result_Type t > struct Result_type2type
diff --git a/instructionAPI/src/InstructionDecoder-aarch64.C b/instructionAPI/src/InstructionDecoder-aarch64.C
index 6d1aa06..e168f1a 100644
--- a/instructionAPI/src/InstructionDecoder-aarch64.C
+++ b/instructionAPI/src/InstructionDecoder-aarch64.C
@@ -143,8 +143,8 @@ namespace Dyninst
is64Bit(true), isValid(true), insn(0), insn_in_progress(NULL),
hasHw(false), hasShift(false), hasOption(false), hasN(false),
immr(0), immrLen(0), sField(0), nField(0), nLen(0),
- immlo(0), immloLen(0), _szField(-1), _Q(1), size(-1),
- cmode(0), op(0), simdAlphabetImm(0)
+ immlo(0), immloLen(0), _szField(-1), size(-1),
+ cmode(0), op(0), simdAlphabetImm(0), _Q(1)
{
aarch64_insn_entry::buildInsnTable();
aarch64_mask_entry::buildDecoderTable();
@@ -1060,8 +1060,10 @@ void InstructionDecoder_aarch64::getMemRefIndexLiteral_RT(Result_Type &rt)
rt = s32;
break;
case 0x3:
+ rt = invalid_type;
break;
default:
+ rt = invalid_type;
isValid = false;
break;
}
diff --git a/instructionAPI/src/InstructionDecoder-x86.C b/instructionAPI/src/InstructionDecoder-x86.C
index 265ecc6..431a31a 100644
--- a/instructionAPI/src/InstructionDecoder-x86.C
+++ b/instructionAPI/src/InstructionDecoder-x86.C
@@ -792,10 +792,8 @@ namespace Dyninst
unsigned int optype = operand.optype;
int vex_vvvv = 0;
- bool has_vex = 0;
if(decodedInstruction && decodedInstruction->getPrefix()->vex_prefix[0])
{
- has_vex = true;
/* The vvvv bits are bits 3, 4, 5, 6 and are in 1's complement */
if(decodedInstruction->getPrefix()->vex_prefix[2]) /* AVX512 (EVEX) */
{
diff --git a/parseAPI/src/BoundFactData.C b/parseAPI/src/BoundFactData.C
index f7595e0..599639d 100644
--- a/parseAPI/src/BoundFactData.C
+++ b/parseAPI/src/BoundFactData.C
@@ -601,11 +601,7 @@ void BoundValue::Invert() {
}
-static bool IsInReadOnlyRegion(Block *b, Address low, Address high) {
-#if defined(os_windows)
- low -= b->obj()->cs()->loadAddress();
- high -= b->obj()->cs()->loadAddress();
-#endif
+static bool IsInReadOnlyRegion(Address low, Address high) {
// Now let's assume it is always in a read only region
// unless it is reading a single memory location
return low != high;
@@ -622,14 +618,14 @@ static bool IsTableIndex(set<uint64_t> &values) {
void BoundValue::MemoryRead(Block* b, int readSize) {
if (interval != StridedInterval::top) {
- if (IsInReadOnlyRegion(b, interval.low, interval.high)) {
- set<uint64_t> values;
- Address memAddrLow = interval.low;
- Address memAddrHigh = interval.high;
+ Address memAddrLow = interval.low;
+ Address memAddrHigh = interval.high;
#if defined(os_windows)
- memAddrLow -= b->obj()->cs()->loadAddress();
- memAddrHigh -= b->obj()->cs()->loadAddress();
+ memAddrLow -= b->obj()->cs()->loadAddress();
+ memAddrHigh -= b->obj()->cs()->loadAddress();
#endif
+ if (IsInReadOnlyRegion(memAddrLow, memAddrHigh)) {
+ set<uint64_t> values;
if (interval.size() <= MAX_TABLE_ENTRY && b->obj()->cs()->isValidAddress(memAddrLow)) {
for (Address memAddr = memAddrLow ; memAddr <= memAddrHigh; memAddr += interval.stride) {
if (!b->obj()->cs()->isValidAddress(memAddr)) {
diff --git a/parseAPI/src/IA_aarch64Details.C b/parseAPI/src/IA_aarch64Details.C
index f6143ac..bb47baf 100644
--- a/parseAPI/src/IA_aarch64Details.C
+++ b/parseAPI/src/IA_aarch64Details.C
@@ -108,7 +108,7 @@ namespace Dyninst
};
-bool IA_aarch64Details::findTableAddrNoTOC(const IA_IAPI* blockToCheck)
+bool IA_aarch64Details::findTableAddrNoTOC(const IA_IAPI* /*blockToCheck*/)
{
assert(0);
return tableStartAddress == 0;
@@ -133,22 +133,22 @@ namespace detail_aarch64
Block* src = e->src();
return visited.find(src) != visited.end();
}
- void processPredecessor(Edge* e, std::set<Block*>& visited, std::deque<Block*>& worklist)
+ void processPredecessor(Edge* /*e*/, std::set<Block*>& /*visited*/, std::deque<Block*>& /*worklist*/)
{
assert(0);
}
};
-bool IA_aarch64Details::scanForAdjustOrBase(IA_IAPI::allInsns_t::const_iterator start,
- IA_IAPI::allInsns_t::const_iterator end,
- RegisterAST::Ptr &jumpAddrReg) {
+bool IA_aarch64Details::scanForAdjustOrBase(IA_IAPI::allInsns_t::const_iterator /*start*/,
+ IA_IAPI::allInsns_t::const_iterator /*end*/,
+ RegisterAST::Ptr &/*jumpAddrReg*/) {
assert(0);
return true;
}
// Like the above, but a wider net
-bool IA_aarch64Details::findTableBase(IA_IAPI::allInsns_t::const_iterator start,
- IA_IAPI::allInsns_t::const_iterator end) {
+bool IA_aarch64Details::findTableBase(IA_IAPI::allInsns_t::const_iterator /*start*/,
+ IA_IAPI::allInsns_t::const_iterator /*end*/) {
assert(0);
return true;
}
@@ -156,8 +156,8 @@ bool IA_aarch64Details::findTableBase(IA_IAPI::allInsns_t::const_iterator start,
// This should only be called on a known indirect branch...
-bool IA_aarch64Details::parseJumpTable(Block* currBlk,
- std::vector<std::pair< Address, EdgeTypeEnum> >& outEdges)
+bool IA_aarch64Details::parseJumpTable(Block* /*currBlk*/,
+ std::vector<std::pair< Address, EdgeTypeEnum> >& /*outEdges*/)
{
assert(0);
return true;
diff --git a/parseAPI/src/Parser.C b/parseAPI/src/Parser.C
index ef8aca8..4442a34 100644
--- a/parseAPI/src/Parser.C
+++ b/parseAPI/src/Parser.C
@@ -885,7 +885,6 @@ Parser::parse_frame(ParseFrame & frame, bool recursive) {
ParseWorkElem * work = frame.popWork();
if (work->order() == ParseWorkElem::call) {
Function * ct = NULL;
- Edge * ce = NULL;
if (!work->callproc()) {
// If we're not doing recursive traversal, skip *all* of the call edge processing.
@@ -909,12 +908,10 @@ Parser::parse_frame(ParseFrame & frame, bool recursive) {
work->edge()->src(),
work->edge());
ct = ctp.first;
- ce = ctp.second;
work->mark_call();
} else {
ct = _parse_data->findFunc(frame.codereg,work->target());
- ce = work->edge();
}
if (recursive && ct &&
diff --git a/proccontrol/src/DecoderWindows.C b/proccontrol/src/DecoderWindows.C
index c940a77..8ce245b 100644
--- a/proccontrol/src/DecoderWindows.C
+++ b/proccontrol/src/DecoderWindows.C
@@ -34,7 +34,6 @@
#include "windows_thread.h"
#include "ProcPool.h"
#include <iostream>
-#include "boost/scoped_ptr.hpp"
#include "irpc.h"
#include <psapi.h>
#include "procControl/h/Mailbox.h"
diff --git a/proccontrol/src/linux.C b/proccontrol/src/linux.C
index 97846ed..52e9fa6 100644
--- a/proccontrol/src/linux.C
+++ b/proccontrol/src/linux.C
@@ -65,6 +65,8 @@
#include "common/src/linuxKludges.h"
#include "common/src/parseauxv.h"
+#include "boost/shared_ptr.hpp"
+
//needed by GETREGSET/SETREGSET
#if defined(arch_aarch64)
#include<sys/user.h>
@@ -338,7 +340,7 @@ bool DecoderLinux::decode(ArchEvent *ae, std::vector<Event::ptr> &events)
// do not handle the bp and clear the bp.
bool rst = lthread->proc()->rmBreakpoint(addr, lthread->BPptr_fakeSyscallExitBp );
if( !rst){
- perr_printf("ARM-error: Failed to remove inserted BP, addr %p.\n",
+ perr_printf("ARM-error: Failed to remove inserted BP, addr %lx.\n",
addr);
}
lthread->isSet_fakeSyscallExitBp = false;
@@ -1133,16 +1135,18 @@ bool linux_process::plat_attachWillTriggerStop() {
// Retrieve the state of the process and its controlling tty
snprintf(procName, 64, "/proc/%d/stat", pid);
- FILE *sfile = fopen(procName, "r");
- if ( sfile == NULL ) {
+ boost::shared_ptr<FILE> sfile(fopen(procName, "r"), fclose);
+ if (!sfile) {
perr_printf("Failed to determine whether attach would trigger stop -- assuming it will\n");
return true;
}
- fscanf(sfile, "%d %255s %c %d %d %d",
+ if(fscanf(sfile.get(), "%d %255s %c %d %d %d",
&tmpPid, cmd, &state,
- &tmpPid, &tmpPid, &ttyNumber);
- fclose(sfile);
+ &tmpPid, &tmpPid, &ttyNumber) < 0) {
+ perr_printf("Failed to determine whether attach would trigger stop -- assuming it will\n");
+ return true;
+ }
// If the process is stopped and it has a controlling tty, an attach
// will not trigger a stop
@@ -1917,15 +1921,18 @@ bool linux_process::readStatM(unsigned long &stk, unsigned long &heap, unsigned
path[63] = '\0';
unsigned long size, resident, shared, text, lib, data, dt;
- FILE *f = fopen(path, "r");
+ boost::shared_ptr<FILE> f(fopen(path, "r"), fclose);
if (!f) {
perr_printf("Could not open %s: %s\n", path, strerror(errno));
setLastError(err_internal, "Could not access /proc");
return false;
}
- fscanf(f, "%lu %lu %lu %lu %lu %lu %lu", &size, &resident, &shared,
- &text, &lib, &data, &dt);
- fclose(f);
+ if(fscanf(f.get(), "%lu %lu %lu %lu %lu %lu %lu", &size, &resident, &shared,
+ &text, &lib, &data, &dt) < 0) {
+ perr_printf("Could not read from %s: %s\n", path, strerror(errno));
+ setLastError(err_internal, "Could not read from /proc");
+ return false;
+ }
unsigned long page_size = getpagesize();
stk = 0;
diff --git a/proccontrol/src/loadLibrary/codegen-aarch64.C b/proccontrol/src/loadLibrary/codegen-aarch64.C
index 895cdbe..3c1e273 100644
--- a/proccontrol/src/loadLibrary/codegen-aarch64.C
+++ b/proccontrol/src/loadLibrary/codegen-aarch64.C
@@ -50,9 +50,11 @@ bool Codegen::generateCallAARCH64(Address addr, const std::vector<Address> &args
(char)0xf2, (char)0xe0, (char)0x00, (char)0x00, // movk x0, #0, lsl #48
};
+ /*
char blr_buf[] = {
(char)0xd6, (char)0x3f, (char)0x00, (char)0x00, // blr x0
};
+ */
char* _buf;
_buf = (char *)malloc(sizeof(movLong_buf));
diff --git a/proccontrol/src/mmapalloc.C b/proccontrol/src/mmapalloc.C
index b58eb1b..973e888 100644
--- a/proccontrol/src/mmapalloc.C
+++ b/proccontrol/src/mmapalloc.C
@@ -592,9 +592,8 @@ bool mmap_alloc_process::plat_createAllocationSnippet(Dyninst::Address addr, boo
*((uint16_t *) (((char *) buffer)+addr_hi_position)) = (uint16_t)(addr >> 16);
*((uint16_t *) (((char *) buffer)+addr_lo_position)) = (uint16_t)addr;
- }else if( getTargetArch() == Arch_aarch64 ){
+ } else if( getTargetArch() == Arch_aarch64 ){
const void *buf_tmp;
- unsigned int addr_size;
unsigned int addr_pos, size_pos, flags_pos;
bool use_linux = ( getOS() == Linux );
@@ -606,7 +605,6 @@ bool mmap_alloc_process::plat_createAllocationSnippet(Dyninst::Address addr, boo
addr_pos = linux_aarch64_mmap_addr_position;
size_pos = linux_aarch64_mmap_size_position;
flags_pos = linux_aarch64_mmap_flags_position;
- addr_size = 8;
}
else {
assert(0); //Fill in the entry in mmapalloc.h for this system
diff --git a/symtabAPI/src/Function.C b/symtabAPI/src/Function.C
index 09aadff..0d3e80b 100644
--- a/symtabAPI/src/Function.C
+++ b/symtabAPI/src/Function.C
@@ -51,7 +51,7 @@ using namespace std;
using namespace Dyninst;
using namespace Dyninst::SymtabAPI;
-FunctionBase::FunctionBase(Symbol *sym) :
+FunctionBase::FunctionBase() :
locals(NULL),
params(NULL),
functionSize_(0),
@@ -62,29 +62,6 @@ FunctionBase::FunctionBase(Symbol *sym) :
{
}
-FunctionBase::FunctionBase() :
- locals(NULL),
- params(NULL),
- functionSize_(0),
- retType_(NULL),
- inline_parent(NULL),
- frameBaseExpanded_(false),
- data(NULL)
-{
-}
-
-FunctionBase::FunctionBase(Module *m) :
- locals(NULL),
- params(NULL),
- functionSize_(0),
- retType_(NULL),
- inline_parent(NULL),
- frameBaseExpanded_(false),
- data(NULL)
-
-{
-}
-
Type *FunctionBase::getReturnType() const
{
getModule()->exec()->parseTypesNow();
@@ -334,7 +311,7 @@ void FunctionBase::setData(void *d)
}
Function::Function(Symbol *sym)
- : FunctionBase(sym), Aggregate(sym)
+ : FunctionBase(), Aggregate(sym)
{}
Function::Function()
@@ -453,7 +430,7 @@ bool FunctionBase::operator==(const FunctionBase &f)
}
InlinedFunction::InlinedFunction(FunctionBase *parent) :
- FunctionBase(parent->getModule()),
+ FunctionBase(),
callsite_file(NULL),
callsite_line(0),
module_(parent->getModule())
@@ -472,13 +449,13 @@ bool InlinedFunction::removeSymbol(Symbol *)
return false;
}
-bool InlinedFunction::addMangledName(std::string name, bool isPrimary)
+bool InlinedFunction::addMangledName(std::string name, bool /*isPrimary*/)
{
name_ = name;
return true;
}
-bool InlinedFunction::addPrettyName(std::string name, bool isPrimary)
+bool InlinedFunction::addPrettyName(std::string name, bool /*isPrimary*/)
{
name_ = name;
return true;
diff --git a/symtabAPI/src/dwarfWalker.C b/symtabAPI/src/dwarfWalker.C
index 016a49c..074224f 100644
--- a/symtabAPI/src/dwarfWalker.C
+++ b/symtabAPI/src/dwarfWalker.C
@@ -78,6 +78,7 @@ DwarfWalker::DwarfWalker(Symtab *symtab, Dwarf_Debug &dbg)
dbg_(dbg),
mod_(NULL),
symtab_(symtab),
+ srcFileList_(NULL),
tc_(NULL),
is_mangled_name_(false),
modLow(0),
@@ -91,8 +92,7 @@ DwarfWalker::DwarfWalker(Symtab *symtab, Dwarf_Debug &dbg)
signature(),
typeoffset(0),
next_cu_header(0),
- compile_offset(0),
- srcFileList_(NULL)
+ compile_offset(0)
{
}
diff --git a/symtabAPI/src/emitElf-64.C b/symtabAPI/src/emitElf-64.C
index e28aa21..56e3bc5 100644
--- a/symtabAPI/src/emitElf-64.C
+++ b/symtabAPI/src/emitElf-64.C
@@ -865,7 +865,10 @@ bool emitElf64<ElfTypes>::driver(std::string fName) {
unsigned long ehdr_off = (unsigned long) &(((Elf_Ehdr *) 0x0)->e_phoff);
lseek(newfd, ehdr_off, SEEK_SET);
Elf_Off offset = (Elf_Off) phdr_offset;
- write(newfd, &offset, sizeof(Elf_Off));
+ if(write(newfd, &offset, sizeof(Elf_Off)) < 0) {
+ close(newfd);
+ return false;
+ }
}
close(newfd);
--
2.8.1
|