Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vxworks support #14

Merged
merged 11 commits into from
Mar 11, 2021
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ROOT_DIR :=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
mkfile_path := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ROOT_DIR := $(shell cd $(shell dirname $(mkfile_path)); pwd)
BUILD_DIR := $(ROOT_DIR)/build
COVERAGE_DIR := $(BUILD_DIR)/coverage

Expand Down
59 changes: 33 additions & 26 deletions src/Juicer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,31 +1292,33 @@ Symbol * Juicer::process_DW_TAG_base_type(ElfFile& elf, Dwarf_Debug dbg, Dwarf_D
logger.logError("Error in dwarf_formstring. errno=%u %s", dwarf_errno(error),
dwarf_errmsg(error));
}
}

/* See if we already have this symbol. */
cName = dieName;
outSymbol = elf.getSymbol(cName);
if(outSymbol == 0)
{
/* No. This is new. Process it. */

/* Get the size of this datatype. */
if(res == DW_DLV_OK)
else
{
res = dwarf_bytesize(inDie, &byteSize, &error);
if(res != DW_DLV_OK)
{
logger.logError("Error in dwarf_bytesize. %u errno=%u %s", __LINE__, dwarf_errno(error),
dwarf_errmsg(error));
}
}
/* See if we already have this symbol. */
cName = dieName;
outSymbol = elf.getSymbol(cName);
if(outSymbol == 0)
{
/* No. This is new. Process it. */

/* We have everything we need. Add this to the elf. */
if(res == DW_DLV_OK)
{
std::string sDieName = dieName;
outSymbol = elf.addSymbol(sDieName, byteSize);
/* Get the size of this datatype. */
if(res == DW_DLV_OK)
{
res = dwarf_bytesize(inDie, &byteSize, &error);
if(res != DW_DLV_OK)
{
logger.logError("Error in dwarf_bytesize. %u errno=%u %s", __LINE__, dwarf_errno(error),
dwarf_errmsg(error));
}
}

/* We have everything we need. Add this to the elf. */
if(res == DW_DLV_OK)
{
std::string sDieName = dieName;
outSymbol = elf.addSymbol(sDieName, byteSize);
}
}
}
}

Expand Down Expand Up @@ -1619,7 +1621,7 @@ void Juicer::process_DW_TAG_structure_type(ElfFile& elf, Symbol& symbol, Dwarf_D
res = dwarf_formudata(attr_struct, &memberLocation, &error);
if(res != DW_DLV_OK)
{
logger.logError("Error in dwarf_formudata , level %d. errno=%u %s", dwarf_errno(error),
logger.logError("Error in dwarf_formudata , errno=%u %s", dwarf_errno(error),
dwarf_errmsg(error));
}
}
Expand Down Expand Up @@ -2174,7 +2176,7 @@ JuicerEndianness_t Juicer::getEndianness()

ident_buffer = elf_hdr_64->e_ident;

if(ident_buffer[EI_DATA] == 0)
if(ident_buffer[EI_DATA] == 2)
{
rc = JUICER_ENDIAN_BIG;
}
Expand Down Expand Up @@ -2203,7 +2205,7 @@ JuicerEndianness_t Juicer::getEndianness()

ident_buffer = elf_hdr_32->e_ident;

if(ident_buffer[EI_DATA] == 0)
if(ident_buffer[EI_DATA] == 2)
lorenzo-gomez-windhover marked this conversation as resolved.
Show resolved Hide resolved
{
rc = JUICER_ENDIAN_BIG;
}
Expand Down Expand Up @@ -2310,6 +2312,11 @@ int Juicer::parse( std::string& elfFilePath)
false: true);
elf->setDate(date);

std::cout << "*****************************" << std::endl;
std::cout << JUICER_ENDIAN_BIG << std::endl;
std::cout << JUICER_ENDIAN_LITTLE << std::endl;
std::cout << endianness << std::endl;

if(JUICER_ENDIAN_BIG == endianness)
{
logger.logDebug("Detected big endian.");
Expand Down