[Ltrace-devel] r52 - ltrace/trunk

Ian Wienand ianw-guest at costa.debian.org
Mon Aug 7 02:03:16 UTC 2006


Author: ianw-guest
Date: 2006-08-07 02:03:15 +0000 (Mon, 07 Aug 2006)
New Revision: 52

Modified:
   ltrace/trunk/ChangeLog
   ltrace/trunk/elf.c
Log:
refactor to stop warnings


Modified: ltrace/trunk/ChangeLog
===================================================================
--- ltrace/trunk/ChangeLog	2006-07-18 11:06:26 UTC (rev 51)
+++ ltrace/trunk/ChangeLog	2006-08-07 02:03:15 UTC (rev 52)
@@ -1,3 +1,7 @@
+2006-07-26  Ian Wienand  <ianw at debian.org>
+
+	* elf.c: refactor opd2addr to not pass void* (fix warnings)
+
 2006-07-18  Petr Machata <pmachata at redhat.com>
 
 	* elf.c: replace nonexistant elf_plt2addr with opd2addr, fix

Modified: ltrace/trunk/elf.c
===================================================================
--- ltrace/trunk/elf.c	2006-07-18 11:06:26 UTC (rev 51)
+++ ltrace/trunk/elf.c	2006-08-07 02:03:15 UTC (rev 52)
@@ -23,7 +23,7 @@
 			       struct library_symbol **library_symbolspp,
 			       enum toplt type_of_plt, int is_weak);
 static int in_load_libraries(const char *name, struct ltelf *lte);
-static GElf_Addr opd2addr(struct ltelf *ltc, void *addr);
+static GElf_Addr opd2addr(struct ltelf *ltc, GElf_Addr addr);
 
 #ifdef PLT_REINITALISATION_BP
 extern char *PLTs_initialized_by_here;
@@ -405,22 +405,19 @@
 	return 0;
 }
 
-static GElf_Addr opd2addr(struct ltelf *lte, void *addr)
+static GElf_Addr opd2addr(struct ltelf *lte, GElf_Addr addr)
 {
-	long base;
-	long offset;
-	GElf_Addr ret_val;
+	unsigned long base, offset;
 
 	if (!lte->opd)
-		return (GElf_Addr) (long) addr;
+		return addr;
 
-	base = (long)lte->opd->d_buf;
-	offset = (long)addr - (long)lte->opd_addr;
+	base = (unsigned long)lte->opd->d_buf;
+	offset = (unsigned long)addr - (unsigned long)lte->opd_addr;
 	if (offset > lte->opd_size)
 		error(EXIT_FAILURE, 0, "static plt not in .opd");
 
-	ret_val = (GElf_Addr) * (long *)(base + offset);
-	return ret_val;
+	return (GElf_Addr)(base + offset);
 }
 
 struct library_symbol *read_elf(struct process *proc)
@@ -430,7 +427,6 @@
 	size_t i;
 	struct opt_x_t *xptr;
 	struct library_symbol **lib_tail = NULL;
-	struct opt_x_t *main_cheat;
 	int exit_out = 0;
 
 	elf_version(EV_CURRENT);
@@ -482,6 +478,8 @@
 	}
 
 #ifdef PLT_REINITALISATION_BP
+	struct opt_x_t *main_cheat;
+
 	if (proc->need_to_reinitialize_breakpoints) {
 		/* Add "PLTs_initialized_by_here" to opt_x list, if not
                    already there. */
@@ -523,7 +521,7 @@
 			if (xptr->name && strcmp(xptr->name, name) == 0) {
 				/* FIXME: Should be able to use &library_symbols as above.  But
 				   when you do, none of the real library symbols cause breaks. */
-				add_library_symbol(opd2addr(lte, (void*)addr),
+				add_library_symbol(opd2addr(lte, addr),
 						   name, lib_tail, LS_TOPLT_NONE, 0);
 				xptr->found = 1;
 				break;
@@ -536,8 +534,7 @@
 			if (strcmp(xptr->name, PLTs_initialized_by_here) == 0) {
 				if (lte->ehdr.e_entry) {
 					add_library_symbol (
-						opd2addr (lte, (void*)(long)
-							lte->ehdr.e_entry),
+						opd2addr (lte, lte->ehdr.e_entry),
 						PLTs_initialized_by_here,
 						lib_tail, 1, 0);
 					fprintf (stderr, "WARNING: Using e_ent"




More information about the Ltrace-devel mailing list