Be more verbose
authornorly <ny-git@enpas.org>
Fri, 24 May 2013 23:46:12 +0000 (00:46 +0100)
committernorly <ny-git@enpas.org>
Fri, 24 May 2013 23:46:12 +0000 (00:46 +0100)
include/libelfu/debug.h
src/model/reladd.c

index 4c823457ba42c00ddae3d40006cae1e2b0bc2b14..6b817b3ca07b53db2450519aaa0e0e275a1182be 100644 (file)
@@ -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))
index 782d245375de4064a65c42779249227ac62d49dd..41d7cfba004a4a2bb146fbee058f772db8561dbc 100644 (file)
@@ -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);