Skip to content

Commit

Permalink
Core file images note: Add text delta field
Browse files Browse the repository at this point in the history
  • Loading branch information
weinhold committed Apr 29, 2016
1 parent 9266cd6 commit a0c364c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
4 changes: 4 additions & 0 deletions headers/os/kernel/elf.h
Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down
16 changes: 9 additions & 7 deletions src/apps/debugger/elf/CoreFile.cpp
Expand Up @@ -65,17 +65,18 @@ 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),
fInitRoutine(initRoutine),
fTermRoutine(termRoutine),
fTextBase(textBase),
fTextSize(textSize),
fTextDelta(textDelta),
fDataBase(dataBase),
fDataSize(dataSize),
fDeviceId(deviceId),
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/apps/debugger/elf/CoreFile.h
Expand Up @@ -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,
Expand All @@ -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; }
Expand All @@ -84,6 +86,7 @@ struct CoreFileImageInfo {
uint64 fTermRoutine;
uint64 fTextBase;
uint64 fTextSize;
int64 fTextDelta;
uint64 fDataBase;
uint64 fDataSize;
int32 fDeviceId;
Expand Down
9 changes: 8 additions & 1 deletion src/system/kernel/debug/core_dump.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -317,14 +318,18 @@ struct ImageInfo : DoublyLinkedListLinkImpl<ImageInfo> {
addr_t TextBase() const
{
return fText;

}

size_t TextSize() const
{
return fTextSize;
}

ssize_t TextDelta() const
{
return fTextDelta;
}

addr_t DataBase() const
{
return fData;
Expand Down Expand Up @@ -362,6 +367,7 @@ struct ImageInfo : DoublyLinkedListLinkImpl<ImageInfo> {
addr_t fData;
size_t fTextSize;
size_t fDataSize;
ssize_t fTextDelta;
addr_t fSymbolTable;
addr_t fSymbolHash;
addr_t fStringTable;
Expand Down Expand Up @@ -1302,6 +1308,7 @@ struct CoreDumper {
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();
Expand Down

0 comments on commit a0c364c

Please sign in to comment.