ltrace/ltrace-0.5-exec-stripped.patch
Petr Machata 6fe6558eee - When the value of undefined symbol in PPC 32-bit binary is 0, use
PPC-specific magic to compute the PLT slots.
- Fix a problem with tracing stripped binary after execl on architectures
    that need PLT reinitalisation breakpoint.
- Support tracing of 31-bit binaries with 64-bit ltrace
- Fix handling of the case where forked child is reported before parent's
    fork event
- Patch from Supriya Kannery implements fetching 5th and further function
    arguments on s390
2010-05-19 15:42:22 +00:00

54 lines
1.8 KiB
Diff

--- ltrace-0.5/elf.c~ 2010-03-25 14:07:20.000000000 +0100
+++ ltrace-0.5/elf.c 2010-03-31 13:11:35.000000000 +0200
@@ -435,6 +435,7 @@ struct library_symbol *read_elf(struct p
struct library_symbol *library_symbols = NULL;
struct ltelf lte[MAX_LIBRARY + 1];
size_t i;
+ struct opt_x_t *opt_x_loc = opt_x;
struct opt_x_t *xptr;
struct library_symbol **lib_tail = NULL;
struct opt_x_t *main_cheat;
@@ -502,11 +503,11 @@ struct library_symbol *read_elf(struct p
main_cheat = (struct opt_x_t *)malloc(sizeof(struct opt_x_t));
if (main_cheat == NULL)
error(EXIT_FAILURE, 0, "Couldn't allocate memory");
- main_cheat->next = opt_x;
+ main_cheat->next = opt_x_loc;
main_cheat->found = 0;
main_cheat->name = PLTs_initialized_by_here;
- for (xptr = opt_x; xptr; xptr = xptr->next)
+ for (xptr = opt_x_loc; xptr; xptr = xptr->next)
if (strcmp(xptr->name, PLTs_initialized_by_here) == 0
&& main_cheat) {
free(main_cheat);
@@ -514,7 +515,7 @@ struct library_symbol *read_elf(struct p
break;
}
if (main_cheat)
- opt_x = main_cheat;
+ opt_x_loc = main_cheat;
}
#endif
@@ -533,7 +534,7 @@ struct library_symbol *read_elf(struct p
if (!addr)
continue;
- for (xptr = opt_x; xptr; xptr = xptr->next)
+ for (xptr = opt_x_loc; xptr; xptr = xptr->next)
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. */
@@ -543,7 +544,7 @@ struct library_symbol *read_elf(struct p
break;
}
}
- for (xptr = opt_x; xptr; xptr = xptr->next)
+ for (xptr = opt_x_loc; xptr; xptr = xptr->next)
if ( ! xptr->found) {
char *badthing = "WARNING";
#ifdef PLT_REINITALISATION_BP
Diff finished. Wed Mar 31 13:12:38 2010