You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-util/ltrace/files/ltrace-0.3.31-64bit-fixes.p...

184 lines
5.8 KiB

--- ltrace-0.3.31/sysdeps/linux-gnu/breakpoint.c.64bit-fixes 2002-03-03 02:25:55.000000000 +0100
+++ ltrace-0.3.31/sysdeps/linux-gnu/breakpoint.c 2003-02-11 16:37:32.000000000 +0100
@@ -14,7 +14,7 @@ enable_breakpoint(pid_t pid, struct brea
int i,j;
if (opt_d>1) {
- output_line(0, "enable_breakpoint(%d,0x%08x)", pid, sbp->addr);
+ output_line(0, "enable_breakpoint(%d,%p)", pid, sbp->addr);
}
for(i=0; i < 1+((BREAKPOINT_LENGTH-1)/sizeof(long)); i++) {
@@ -34,7 +34,7 @@ disable_breakpoint(pid_t pid, const stru
int i,j;
if (opt_d>1) {
- output_line(0, "disable_breakpoint(%d,0x%08x)", pid, sbp->addr);
+ output_line(0, "disable_breakpoint(%d,%p)", pid, sbp->addr);
}
for(i=0; i < 1+((BREAKPOINT_LENGTH-1)/sizeof(long)); i++) {
--- ltrace-0.3.31/elf.h.64bit-fixes 2001-07-02 16:53:04.000000000 +0200
+++ ltrace-0.3.31/elf.h 2003-02-11 16:37:32.000000000 +0100
@@ -4,12 +4,18 @@
#include <elf.h>
#include "ltrace.h"
+#if defined(__x86_64__)
+#define ELF_(X) Elf64_##X
+#else
+#define ELF_(X) Elf32_##X
+#endif
+
struct ltelf {
int fd;
void* maddr;
- Elf32_Ehdr* ehdr;
+ ELF_(Ehdr)* ehdr;
char* strtab;
- Elf32_Sym* symtab;
+ ELF_(Sym)* symtab;
int symtab_len;
};
--- ltrace-0.3.31/output.c.64bit-fixes 2003-02-02 22:51:33.000000000 +0100
+++ ltrace-0.3.31/output.c 2003-02-11 16:37:32.000000000 +0100
@@ -88,11 +88,11 @@ begin_of_line(enum tof type, struct proc
}
if (opt_i) {
if (type==LT_TOF_FUNCTION) {
- current_column += fprintf(output, "[%08x] ",
- (unsigned)proc->return_addr);
+ current_column += fprintf(output, "[%p] ",
+ proc->return_addr);
} else {
- current_column += fprintf(output, "[%08x] ",
- (unsigned)proc->instruction_pointer);
+ current_column += fprintf(output, "[%p] ",
+ proc->instruction_pointer);
}
}
if (opt_n > 0 && type!=LT_TOF_NONE) {
--- ltrace-0.3.31/elf.c.64bit-fixes 2003-01-31 10:48:12.000000000 +0100
+++ ltrace-0.3.31/elf.c 2003-02-11 16:37:32.000000000 +0100
@@ -62,7 +62,7 @@ do_init_elf(struct ltelf *lte, const cha
);
exit(1);
}
- if (sbuf.st_size < sizeof(Elf32_Ehdr)) {
+ if (sbuf.st_size < sizeof(ELF_(Ehdr))) {
fprintf(
stderr,
"\"%s\" is not an ELF binary object\n",
@@ -114,8 +114,8 @@ do_close_elf(struct ltelf *lte) {
static void
do_load_elf_symtab(struct ltelf *lte) {
void *maddr = lte->maddr;
- Elf32_Ehdr *ehdr = lte->ehdr;
- Elf32_Shdr *shdr = (Elf32_Shdr *)(maddr + ehdr->e_shoff);
+ ELF_(Ehdr) *ehdr = lte->ehdr;
+ ELF_(Shdr) *shdr = (ELF_(Shdr) *)(maddr + ehdr->e_shoff);
int i;
/*
@@ -126,7 +126,7 @@ do_load_elf_symtab(struct ltelf *lte) {
for(i = 0; i < ehdr->e_shnum; i++) {
if (shdr[i].sh_type == SHT_DYNSYM) {
- lte->symtab = (Elf32_Sym *)(maddr + shdr[i].sh_offset);
+ lte->symtab = (ELF_(Sym) *)(maddr + shdr[i].sh_offset);
lte->symtab_len = shdr[i].sh_size;
lte->strtab = (char *)(
maddr + shdr[shdr[i].sh_link].sh_offset
@@ -134,9 +134,9 @@ do_load_elf_symtab(struct ltelf *lte) {
}
}
- debug(2, "symtab: 0x%08x", (unsigned)lte->symtab);
+ debug(2, "symtab: %p", lte->symtab);
debug(2, "symtab_len: %lu", lte->symtab_len);
- debug(2, "strtab: 0x%08x", (unsigned)lte->strtab);
+ debug(2, "strtab: %p", lte->strtab);
}
static void
@@ -160,8 +160,8 @@ add_library_symbol(
library_symbols->name = &lte->strtab[lte->symtab[i].st_name];
library_symbols->next = tmp;
- debug(2, "addr: 0x%08x, symbol: \"%s\"",
- (unsigned)lte->symtab[i].st_value,
+ debug(2, "addr: %p, symbol: \"%s\"",
+ (void *)lte->symtab[i].st_value,
&lte->strtab[lte->symtab[i].st_name]);
}
@@ -199,12 +199,12 @@ in_load_libraries(const char *func) {
if (library_num == 0) return 1;
for (i = 0; i < library_num; i++) {
- Elf32_Sym *symtab = library_lte[i].symtab;
+ ELF_(Sym) *symtab = library_lte[i].symtab;
char *strtab = library_lte[i].strtab;
for(
j = 0;
- j < library_lte[i].symtab_len / sizeof(Elf32_Sym);
+ j < library_lte[i].symtab_len / sizeof(ELF_(Sym));
j++
) {
if (
@@ -230,8 +230,8 @@ read_elf(const char *filename) {
do_load_elf_symtab(&lte);
do_init_load_libraries();
- for(i = 0; i < lte.symtab_len / sizeof(Elf32_Sym); i++) {
- Elf32_Sym *symtab = lte.symtab;
+ for(i = 0; i < lte.symtab_len / sizeof(ELF_(Sym)); i++) {
+ ELF_(Sym) *symtab = lte.symtab;
char *strtab = lte.strtab;
if (!symtab[i].st_shndx && symtab[i].st_value) {
--- ltrace-0.3.31/process_event.c.64bit-fixes 2003-02-04 22:48:21.000000000 +0100
+++ ltrace-0.3.31/process_event.c 2003-02-11 16:37:32.000000000 +0100
@@ -221,7 +221,7 @@ process_breakpoint(struct event * event)
struct library_symbol * tmp;
int i,j;
- debug(2, "event: breakpoint (0x%08x)", event->e_un.brk_addr);
+ debug(2, "event: breakpoint (%p)", event->e_un.brk_addr);
if (event->proc->breakpoint_being_enabled) {
/* Reinsert breakpoint */
continue_enabling_breakpoint(event->proc->pid, event->proc->breakpoint_being_enabled);
@@ -277,8 +277,8 @@ process_breakpoint(struct event * event)
}
tmp = tmp->next;
}
- output_line(event->proc, "breakpointed at 0x%08x (?)",
- (unsigned)event->e_un.brk_addr);
+ output_line(event->proc, "breakpointed at %p (?)",
+ event->e_un.brk_addr);
continue_process(event->proc->pid);
}
--- ltrace-0.3.31/display_args.c.64bit-fixes 2002-03-01 17:15:14.000000000 +0100
+++ ltrace-0.3.31/display_args.c 2003-02-11 16:37:32.000000000 +0100
@@ -39,7 +39,7 @@ display_arg(enum tof type, struct proces
if (!arg) {
return fprintf(output, "NULL");
} else {
- return fprintf(output, "0x%08x", (unsigned)arg);
+ return fprintf(output, "%p", (void *)arg);
}
case ARGTYPE_FORMAT:
return display_format(type, proc, arg_num);
@@ -134,7 +134,7 @@ display_unknown(enum tof type, struct pr
if (tmp<1000000 && tmp>-1000000) {
return fprintf(output, "%ld", tmp);
} else {
- return fprintf(output, "0x%08lx", tmp);
+ return fprintf(output, "0x%0*lx", 2 * sizeof(tmp), tmp);
}
}