summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libelfu/debug.h2
-rw-r--r--src/model/reladd.c11
2 files changed, 13 insertions, 0 deletions
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 <stdio.h>
+#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);