From 3f1219f7803599df8556e7fc096a6a239f9a04fd Mon Sep 17 00:00:00 2001 From: Paul Gilliam Date: Mon, 24 Apr 2006 18:25:38 +0200 Subject: Adds some casts that keeps a more picky version of GCC happy. --- ChangeLog | 7 +++++++ elf.c | 10 +++++----- ltrace.h | 2 +- sysdeps/linux-gnu/breakpoint.c | 4 ++-- sysdeps/linux-gnu/trace.c | 4 ++-- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85f3ad0..89f67f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-04-24 Paul Gilliam + + * elf.c: Adds some casts to keep a more picky version of GCC happy. + * sysdeps/linux-gnu/trace.c: ditto. + * sysdeps/linux-gnu/breakpoint.c: ditto. + * ltrace.h: ditto. + 2006-04-24 Paul Gilliam * summery.c: Correct a typo prevented the inclusion of "demangle.h". diff --git a/elf.c b/elf.c index 09ca14f..983fe51 100644 --- a/elf.c +++ b/elf.c @@ -213,7 +213,7 @@ static void do_init_elf(struct ltelf *lte, const char *filename) lte->plt_addr = shdr.sh_addr; lte->plt_size = shdr.sh_size; } else if (strcmp(name, ".opd") == 0) { - lte->opd_addr = (GElf_Addr *) shdr.sh_addr; + lte->opd_addr = (GElf_Addr *) (long) shdr.sh_addr; lte->opd_size = shdr.sh_size; lte->opd = elf_rawdata(scn, NULL); } @@ -300,7 +300,7 @@ static int in_load_libraries(const char *name, struct ltelf *lte) if (!library_num) return 1; - hash = elf_hash(name); + hash = elf_hash((const unsigned char *)name); for (i = 1; i <= library_num; ++i) { Elf32_Word nbuckets, symndx; Elf32_Word *buckets, *chain; @@ -335,7 +335,7 @@ static GElf_Addr elf_plt2addr(struct ltelf *lte, void *addr) GElf_Addr ret_val; if (!lte->opd) - return (GElf_Addr) addr; + return (GElf_Addr) (long) addr; base = (long)lte->opd->d_buf; offset = (long)addr - (long)lte->opd_addr; @@ -439,8 +439,8 @@ struct library_symbol *read_elf(struct process *proc) /* 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(elf_plt2addr - (lte, (void *)addr), name, - lib_tail, 1, 0); + (lte, (void *) (long) addr), + name, lib_tail, 1, 0); xptr->found = 1; break; } diff --git a/ltrace.h b/ltrace.h index db52fc3..66c1a2c 100644 --- a/ltrace.h +++ b/ltrace.h @@ -98,7 +98,7 @@ struct process { struct dict *breakpoints; int breakpoints_enabled; /* -1:not enabled yet, 0:disabled, 1:enabled */ int mask_32bit; /* 1 if 64-bit ltrace is tracing 32-bit process. */ - int personality; + unsigned int personality; int tracesysgood; /* signal indicating a PTRACE_SYSCALL trap */ int callstack_depth; diff --git a/sysdeps/linux-gnu/breakpoint.c b/sysdeps/linux-gnu/breakpoint.c index afcd4bc..051ac00 100644 --- a/sysdeps/linux-gnu/breakpoint.c +++ b/sysdeps/linux-gnu/breakpoint.c @@ -20,7 +20,7 @@ void enable_breakpoint(pid_t pid, struct breakpoint *sbp) #else void enable_breakpoint(pid_t pid, struct breakpoint *sbp) { - int i, j; + unsigned int i, j; debug(1, "enable_breakpoint(%d,%p)", pid, sbp->addr); @@ -50,7 +50,7 @@ void disable_breakpoint(pid_t pid, const struct breakpoint *sbp) #else void disable_breakpoint(pid_t pid, const struct breakpoint *sbp) { - int i, j; + unsigned int i, j; if (opt_d > 1) { output_line(0, "disable_breakpoint(%d,%p)", pid, sbp->addr); diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c index cc7b1b9..136d288 100644 --- a/sysdeps/linux-gnu/trace.c +++ b/sysdeps/linux-gnu/trace.c @@ -50,7 +50,7 @@ static int fork_exec_syscalls[][5] = { */ int fork_p(struct process *proc, int sysnum) { - int i; + unsigned int i; if (proc->personality >= sizeof fork_exec_syscalls / sizeof(fork_exec_syscalls[0])) return 0; @@ -163,7 +163,7 @@ int umovestr(struct process *proc, void *addr, int len, void *laddr) while (offset < len) { a.a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr + offset, 0); for (i = 0; i < sizeof(long); i++) { - if (a.c[i] && offset + i < len) { + if (a.c[i] && offset + (signed)i < len) { *(char *)(laddr + offset + i) = a.c[i]; } else { *(char *)(laddr + offset + i) = '\0'; -- cgit v1.2.3