From 3d899fbfd33a8b44dcbd7dfbc952464731a7e589 Mon Sep 17 00:00:00 2001 From: norly Date: Sat, 25 May 2013 00:46:12 +0100 Subject: [PATCH] Be more verbose --- include/libelfu/debug.h | 2 ++ src/model/reladd.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/libelfu/debug.h b/include/libelfu/debug.h index 4c82345..6b817b3 100644 --- a/include/libelfu/debug.h +++ b/include/libelfu/debug.h @@ -4,6 +4,8 @@ #include +#define ELFU_INFO(...) do { fprintf(stdout, __VA_ARGS__); } while(0) + #define ELFU_WARN(...) do { fprintf(stderr, __VA_ARGS__); } while(0) #define ELFU_WARNELF(function_name) ELFU_WARN(function_name "() failed: %s\n", elf_errmsg(-1)) diff --git a/src/model/reladd.c b/src/model/reladd.c index 782d245..41d7cfb 100644 --- a/src/model/reladd.c +++ b/src/model/reladd.c @@ -98,6 +98,10 @@ static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *ms) } else { injOffset = firstScn->shdr.sh_offset; + ELFU_INFO("Inserting %s at offset 0x%jx...\n", + elfu_mScnName(mrel, ms), + injOffset); + /* Make space */ elfu_mInsertSpaceBefore(me, injOffset, ms->shdr.sh_size); @@ -117,6 +121,9 @@ static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *ms) } else { injOffset = lastScn->shdr.sh_offset + elfu_gScnSizeFile(&lastScn->shdr); + ELFU_INFO("Expanding at offset 0x%jx...\n", + injOffset); + /* Expand NOBITS sections at injection site, if any. */ elfu_mExpandNobits(me, injOffset); @@ -124,6 +131,10 @@ static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *ms) lastScn = elfu_mScnLastInSegment(me, injAnchor); injOffset = lastScn->shdr.sh_offset + elfu_gScnSizeFile(&lastScn->shdr); + ELFU_INFO("Inserting %s at offset 0x%jx...\n", + elfu_mScnName(mrel, ms), + injOffset); + /* Make space */ elfu_mInsertSpaceAfter(me, injOffset, ms->shdr.sh_size); -- 2.30.2