Core file images note: Add text delta field

This commit is contained in:
Ingo Weinhold 2016-04-29 22:18:21 +02:00
parent 9266cd66c7
commit a0c364c70d
4 changed files with 24 additions and 8 deletions

View File

@ -666,6 +666,8 @@ typedef struct {
int64 ni_node; /* node ID of mapped file */
uint32 ni_text_base; /* base address of text segment */
uint32 ni_text_size; /* size of text segment */
int32 ni_text_delta; /* delta of the text segment relative to
load address specified in the ELF file */
uint32 ni_data_base; /* base address of data segment */
uint32 ni_data_size; /* size of data segment */
uint32 ni_symbol_table; /* address of dynamic symbol table */
@ -689,6 +691,8 @@ typedef struct {
int64 ni_node; /* node ID of mapped file */
uint64 ni_text_base; /* base address of text segment */
uint64 ni_text_size; /* size of text segment */
int64 ni_text_delta; /* delta of the text segment relative to
load address specified in the ELF file */
uint64 ni_data_base; /* base address of data segment */
uint64 ni_data_size; /* size of data segment */
uint64 ni_symbol_table; /* address of dynamic symbol table */

View File

@ -65,10 +65,10 @@ CoreFileAreaInfo::CoreFileAreaInfo(ElfSegment* segment, int32 id,
CoreFileImageInfo::CoreFileImageInfo(int32 id, int32 type, uint64 initRoutine,
uint64 termRoutine, uint64 textBase, uint64 textSize, uint64 dataBase,
uint64 dataSize, int32 deviceId, int64 nodeId, uint64 symbolTable,
uint64 symbolHash, uint64 stringTable, CoreFileAreaInfo* textArea,
CoreFileAreaInfo* dataArea, const BString& name)
uint64 termRoutine, uint64 textBase, uint64 textSize, int64 textDelta,
uint64 dataBase, uint64 dataSize, int32 deviceId, int64 nodeId,
uint64 symbolTable, uint64 symbolHash, uint64 stringTable,
CoreFileAreaInfo* textArea, CoreFileAreaInfo* dataArea, const BString& name)
:
fId(id),
fType(type),
@ -76,6 +76,7 @@ CoreFileImageInfo::CoreFileImageInfo(int32 id, int32 type, uint64 initRoutine,
fTermRoutine(termRoutine),
fTextBase(textBase),
fTextSize(textSize),
fTextDelta(textDelta),
fDataBase(dataBase),
fDataSize(dataSize),
fDeviceId(deviceId),
@ -479,6 +480,7 @@ CoreFile::_ReadImagesNote(const void* data, uint32 dataSize)
uint64 termRoutine = Get(entry.ni_term_routine);
uint64 textBase = Get(entry.ni_text_base);
uint64 textSize = Get(entry.ni_text_size);
int64 textDelta = Get(entry.ni_text_delta);
uint64 dataBase = Get(entry.ni_data_base);
uint64 dataSize = Get(entry.ni_data_size);
int32 deviceId = Get(entry.ni_device);
@ -506,9 +508,9 @@ CoreFile::_ReadImagesNote(const void* data, uint32 dataSize)
CoreFileAreaInfo* textArea = _FindArea(textBase);
CoreFileAreaInfo* dataArea = _FindArea(dataBase);
CoreFileImageInfo* image = new(std::nothrow) CoreFileImageInfo(id, type,
initRoutine, termRoutine, textBase, textSize, dataBase, dataSize,
deviceId, nodeId, symbolTable, symbolHash, stringTable, textArea,
dataArea, copiedName);
initRoutine, termRoutine, textBase, textSize, textDelta, dataBase,
dataSize, deviceId, nodeId, symbolTable, symbolHash, stringTable,
textArea, dataArea, copiedName);
if (image == NULL || !fImageInfos.AddItem(image)) {
delete image;
return B_NO_MEMORY;

View File

@ -58,6 +58,7 @@ struct CoreFileImageInfo {
CoreFileImageInfo(int32 id, int32 type,
uint64 initRoutine, uint64 termRoutine,
uint64 textBase, uint64 textSize,
int64 textDelta,
uint64 dataBase, uint64 dataSize,
int32 deviceId, int64 nodeId,
uint64 symbolTable, uint64 symbolHash,
@ -70,6 +71,7 @@ struct CoreFileImageInfo {
int32 Type() const { return fType; }
uint64 TextBase() const { return fTextBase; }
uint64 TextSize() const { return fTextSize; }
int64 TextDelta() const { return fTextDelta; }
uint64 DataBase() const { return fDataBase; }
uint64 DataSize() const { return fDataSize; }
uint64 SymbolTable() const { return fSymbolTable; }
@ -84,6 +86,7 @@ private:
uint64 fTermRoutine;
uint64 fTextBase;
uint64 fTextSize;
int64 fTextDelta;
uint64 fDataBase;
uint64 fDataSize;
int32 fDeviceId;

View File

@ -257,6 +257,7 @@ struct ImageInfo : DoublyLinkedListLinkImpl<ImageInfo> {
fData((addr_t)image->info.basic_info.data),
fTextSize(image->info.basic_info.text_size),
fDataSize(image->info.basic_info.data_size),
fTextDelta(image->info.text_delta),
fSymbolTable((addr_t)image->info.symbol_table),
fSymbolHash((addr_t)image->info.symbol_hash),
fStringTable((addr_t)image->info.string_table)
@ -317,7 +318,6 @@ struct ImageInfo : DoublyLinkedListLinkImpl<ImageInfo> {
addr_t TextBase() const
{
return fText;
}
size_t TextSize() const
@ -325,6 +325,11 @@ struct ImageInfo : DoublyLinkedListLinkImpl<ImageInfo> {
return fTextSize;
}
ssize_t TextDelta() const
{
return fTextDelta;
}
addr_t DataBase() const
{
return fData;
@ -362,6 +367,7 @@ private:
addr_t fData;
size_t fTextSize;
size_t fDataSize;
ssize_t fTextDelta;
addr_t fSymbolTable;
addr_t fSymbolHash;
addr_t fStringTable;
@ -1302,6 +1308,7 @@ private:
entry.ni_text_size = imageInfo->TextSize();
entry.ni_data_base = imageInfo->DataBase();
entry.ni_data_size = imageInfo->DataSize();
entry.ni_text_delta = imageInfo->TextDelta();
entry.ni_symbol_table = imageInfo->SymbolTable();
entry.ni_symbol_hash = imageInfo->SymbolHash();
entry.ni_string_table = imageInfo->StringTable();