[CRIU] [PATCH 2/5] pie: piegen -- Add more debug messages

Cyrill Gorcunov gorcunov at openvz.org
Tue Jun 9 06:18:24 PDT 2015


And fix few typos. No func change.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 pie/piegen/elf.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pie/piegen/elf.c b/pie/piegen/elf.c
index 3c93b2ce951c..a908624135eb 100644
--- a/pie/piegen/elf.c
+++ b/pie/piegen/elf.c
@@ -79,6 +79,7 @@ int handle_elf(const piegen_opt_t *opts, void *mem, size_t size)
 	s64 toc_offset = 0;
 #endif
 
+	pr_debug("Elf at %p size %lu\n", mem, (unsigned long)size);
 	pr_debug("Header\n------------\n");
 	pr_debug("\ttype 0x%x machine 0x%x version 0x%x\n",
 		 (unsigned)hdr->e_type, (unsigned)hdr->e_machine, (unsigned)hdr->e_version);
@@ -400,26 +401,26 @@ int handle_elf(const piegen_opt_t *opts, void *mem, size_t size)
 
 #ifdef ELF_X86_64
 			case R_X86_64_32: /* Symbol + Addend (4 bytes) */
-				pr_debug("\t\t\t\tR_X86_64_32   at 0x%-4lx val 0x%x\n", place, value32);
+				pr_debug("\t\t\t\tR_X86_64_32       at 0x%-4lx val 0x%x\n", place, value32);
 				pr_out("	{ .offset = 0x%-8x, .type = PIEGEN_TYPE_INT, "
 				       ".addend = %-8d, .value = 0x%-16x, }, /* R_X86_64_32 */\n",
 				       (unsigned int)place, addend32, value32);
 				break;
 			case R_X86_64_64: /* Symbol + Addend (8 bytes) */
-				pr_debug("\t\t\t\tR_X86_64_64   at 0x%-4lx val 0x%lx\n", place, value64);
+				pr_debug("\t\t\t\tR_X86_64_64       at 0x%-4lx val 0x%lx\n", place, (long)value64);
 				pr_out("	{ .offset = 0x%-8x, .type = PIEGEN_TYPE_LONG, "
 				       ".addend = %-8ld, .value = 0x%-16lx, }, /* R_X86_64_64 */\n",
 				       (unsigned int)place, (long)addend64, (long)value64);
 				break;
 			case R_X86_64_PC32: /* Symbol + Addend - Place (4 bytes) */
-				pr_debug("\t\t\t\tR_386_PC32 at 0x%-4lx val 0x%x\n", place, value32 + addend32 - (s32)place);
+				pr_debug("\t\t\t\tR_X86_64_PC32     at 0x%-4lx val 0x%x\n", place, value32 + addend32 - (s32)place);
 				/*
 				 * R_X86_64_PC32 are relative, patch them inplace.
 				 */
 				*((s32 *)where) = value32 + addend32 - place;
 				break;
 			case R_X86_64_PLT32: /* ProcLinkage + Addend - Place (4 bytes) */
-				pr_debug("\t\t\t\tR_386_PLT32 at 0x%-4lx val 0x%x\n", place, value32 + addend32 - (s32)place);
+				pr_debug("\t\t\t\tR_X86_64_PLT32    at 0x%-4lx val 0x%x\n", place, value32 + addend32 - (s32)place);
 				/*
 				 * R_X86_64_PLT32 are relative, patch them inplace.
 				 */
@@ -457,6 +458,9 @@ int handle_elf(const piegen_opt_t *opts, void *mem, size_t size)
 		}
 	}
 	pr_out("};\n");
+
+	pr_debug("Finished handling relocs\n");
+
 	pr_out("static __maybe_unused size_t %s = %zd;\n", opts->nrgotpcrel_name, nr_gotpcrel);
 
 	pr_out("static __maybe_unused const char %s[] = {\n\t", opts->stream_name);
-- 
2.4.2



More information about the CRIU mailing list