-
--- 0.7.3-6.1/debian/patches/elf_read_uleb128_184779e4.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/elf_read_uleb128_184779e4.patch 2016-04-08 02:28:08.000000000 +0000
@@ -0,0 +1,75 @@
+From 184779e4e8a42f2e9e7f3cee4bf4eb31e8c84ee4 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Tue, 5 Feb 2013 01:52:05 +0100
+Subject: Add elf_read_{,next_}uleb128
+
+---
+ ltrace-elf.c | 32 ++++++++++++++++++++++++++++++++
+ ltrace-elf.h | 5 +++++
+ 2 files changed, 37 insertions(+)
+
+Index: b/ltrace-elf.c
+===================================================================
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -321,6 +321,38 @@ DEF_READER(elf_read_next_u64, 64)
+ #undef DEF_READER
+
+ int
++elf_read_next_uleb128(Elf_Data *data, GElf_Xword *offset, uint64_t *retp)
++{
++ uint64_t result = 0;
++ int shift = 0;
++ int size = 8 * sizeof result;
++
++ while (1) {
++ uint8_t byte;
++ if (elf_read_next_u8(data, offset, &byte) < 0)
++ return -1;
++
++ uint8_t payload = byte & 0x7f;
++ result |= (uint64_t)payload << shift;
++ shift += 7;
++ if (shift > size && byte != 0x1)
++ return -1;
++ if ((byte & 0x80) == 0)
++ break;
++ }
++
++ if (retp != NULL)
++ *retp = result;
++ return 0;
++}
++
++int
++elf_read_uleb128(Elf_Data *data, GElf_Xword offset, uint64_t *retp)
++{
++ return elf_read_next_uleb128(data, &offset, retp);
++}
++
++int
+ ltelf_init(struct ltelf *lte, const char *filename)
+ {
+ memset(lte, 0, sizeof *lte);
+Index: b/ltrace-elf.h
+===================================================================
+--- a/ltrace-elf.h
++++ b/ltrace-elf.h
+@@ -121,12 +121,17 @@ int elf_read_u16(Elf_Data *data, GElf_Xw
+ int elf_read_u32(Elf_Data *data, GElf_Xword offset, uint32_t *retp);
+ int elf_read_u64(Elf_Data *data, GElf_Xword offset, uint64_t *retp);
+
++/* Read at most 64-bit quantity recorded in an ULEB128 variable-length
++ * encoding. */
++int elf_read_uleb128(Elf_Data *data, GElf_Xword offset, uint64_t *retp);
++
+ /* These are same as above, but update *OFFSET with the width
+ * of read datum. */
+ int elf_read_next_u8(Elf_Data *data, GElf_Xword *offset, uint8_t *retp);
+ int elf_read_next_u16(Elf_Data *data, GElf_Xword *offset, uint16_t *retp);
+ int elf_read_next_u32(Elf_Data *data, GElf_Xword *offset, uint32_t *retp);
+ int elf_read_next_u64(Elf_Data *data, GElf_Xword *offset, uint64_t *retp);
++int elf_read_next_uleb128(Elf_Data *data, GElf_Xword *offset, uint64_t *retp);
+
+ /* Return whether there's AMOUNT more bytes after OFFSET in DATA. */
+ int elf_can_read_next(Elf_Data *data, GElf_Xword offset, GElf_Xword amount);
-
--- 0.7.3-6.1/debian/rules 2016-09-21 11:15:35.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/rules 2018-08-22 10:15:44.000000000 +0000
@@ -2,7 +2,12 @@
cdbs_configure_flags := --with-libunwind=no
+# The configure logic for this is backwards. We need this before checking
+# for elfutils (ELF_C_READ_MMAP)
+CFLAGS=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+
include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/rules/autoreconf.mk
include /usr/share/cdbs/1/class/autotools.mk
install/ltrace::
-
debian/patches/ppc64le-fixes.patch
-
--- 0.7.3-6.1/debian/patches/find_irelative_b061bae3.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/find_irelative_b061bae3.patch 2016-04-08 02:40:20.000000000 +0000
@@ -0,0 +1,71 @@
+From b061bae322edd4894f14ea2aea6baec36d32eda8 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Fri, 25 Oct 2013 23:50:18 +0200
+Subject: Split linux_elf_find_irelative_name out of
+ linux_elf_add_plt_entry_irelative
+
+---
+ sysdeps/linux-gnu/trace.c | 23 ++++++++++++++---------
+ sysdeps/linux-gnu/trace.h | 6 ++++++
+ 2 files changed, 20 insertions(+), 9 deletions(-)
+
+Index: b/sysdeps/linux-gnu/trace.c
+===================================================================
+--- a/sysdeps/linux-gnu/trace.c
++++ b/sysdeps/linux-gnu/trace.c
+@@ -1243,17 +1243,14 @@ irelative_name_cb(GElf_Sym *symbol, cons
+ return CBS_CONT;
+ }
+
+-enum plt_status
+-linux_elf_add_plt_entry_irelative(struct Process *proc, struct ltelf *lte,
+- GElf_Rela *rela, size_t ndx,
+- struct library_symbol **ret)
+-
++char *
++linux_elf_find_irelative_name(struct ltelf *lte, GElf_Rela *rela)
+ {
+ struct irelative_name_data_t data = { rela->r_addend, NULL };
+ if (rela->r_addend != 0
+ && elf_each_symbol(lte, 0,
+ irelative_name_cb, &data).status < 0)
+- return -1;
++ return NULL;
+
+ const char *name;
+ if (data.found_name != NULL) {
+@@ -1268,8 +1265,16 @@ linux_elf_add_plt_entry_irelative(struct
+ #undef NAME
+ }
+
+- if (default_elf_add_plt_entry(proc, lte, name, rela, ndx, ret) < 0)
+- return PLT_FAIL;
++ return strdup(name);
++}
+
+- return PLT_OK;
++enum plt_status
++linux_elf_add_plt_entry_irelative(struct Process *proc, struct ltelf *lte,
++ GElf_Rela *rela, size_t ndx,
++ struct library_symbol **ret)
++{
++ char *name = linux_elf_find_irelative_name(lte, rela);
++ int i = default_elf_add_plt_entry(proc, lte, name, rela, ndx, ret);
++ free(name);
++ return i < 0 ? plt_fail : plt_ok;
+ }
+Index: b/sysdeps/linux-gnu/trace.h
+===================================================================
+--- a/sysdeps/linux-gnu/trace.h
++++ b/sysdeps/linux-gnu/trace.h
+@@ -136,4 +136,10 @@ enum plt_status linux_elf_add_plt_entry_
+ GElf_Rela *rela, size_t ndx,
+ struct library_symbol **ret);
+
++/* Service routine of the above. Determines a name corresponding to
++ * RELA, or invents a new one. Returns NULL on failures, otherwise it
++ * returns a malloc'd pointer that the caller is responsible for
++ * freeing. */
++char *linux_elf_find_irelative_name(struct ltelf *lte, GElf_Rela *rela);
++
+ #endif /* _LTRACE_LINUX_TRACE_H_ */
-
debian/patches/Implement-aarch64-support.patch
-
--- 0.7.3-6.1/debian/control 2018-08-20 06:09:32.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/control 2019-02-01 00:10:30.000000000 +0000
@@ -1,12 +1,13 @@
Source: ltrace
Section: utils
Priority: optional
-Maintainer: Juan Cespedes <cespedes@debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
+XSBC-Original-Maintainer: Juan Cespedes <cespedes@debian.org>
Standards-Version: 3.9.8
-Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 7), autotools-dev, libiberty-dev, libelf-dev, libselinux1-dev
+Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 7), dh-autoreconf, libiberty-dev, libelf-dev, libselinux1-dev
Package: ltrace
-Architecture: alpha amd64 ia64 i386 mips mipsel powerpc powerpcspe ppc64 s390 s390x sparc
+Architecture: linux-any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Tracks runtime library calls in dynamically linked programs
ltrace is a debugging program which runs a specified command until it
-
debian/patches/jmp_irel.patch
-
--- 0.7.3-6.1/debian/patches/arm_vararg_without_vfp_88a0fe50.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/arm_vararg_without_vfp_88a0fe50.patch 2016-04-11 17:31:16.000000000 +0000
@@ -0,0 +1,81 @@
+From 88a0fe50a3fad351cf28ef3902dbd0dd3540735c Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Wed, 6 Feb 2013 19:44:56 +0100
+Subject: VFP shouldn't be used for parameter passing in vararg functions on
+ ARM
+
+---
+ sysdeps/linux-gnu/arm/arch.h | 1 +
+ sysdeps/linux-gnu/arm/fetch.c | 22 +++++++++++++++++++---
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+Index: b/sysdeps/linux-gnu/arm/fetch.c
+===================================================================
+--- a/sysdeps/linux-gnu/arm/fetch.c
++++ b/sysdeps/linux-gnu/arm/fetch.c
+@@ -254,6 +254,7 @@ struct fetch_context {
+ arch_addr_t nsaa;
+ arch_addr_t ret_struct;
+ bool hardfp:1;
++ bool in_varargs:1;
+ };
+
+ static int
+@@ -389,7 +390,7 @@ arch_fetch_arg_next(struct fetch_context
+ const size_t sz = type_sizeof(proc, info);
+ assert(sz != (size_t)-1);
+
+- if (ctx->hardfp) {
++ if (ctx->hardfp && !ctx->in_varargs) {
+ int rc;
+ if ((rc = consider_vfp(ctx, proc, info, valuep)) != 1)
+ return rc;
+@@ -454,7 +455,7 @@ arch_fetch_retval(struct fetch_context *
+ size_t sz = type_sizeof(proc, info);
+ assert(sz != (size_t)-1);
+
+- if (ctx->hardfp) {
++ if (ctx->hardfp && !ctx->in_varargs) {
+ int rc;
+ if ((rc = consider_vfp(ctx, proc, info, valuep)) != 1)
+ return rc;
+@@ -475,7 +476,7 @@ arch_fetch_retval(struct fetch_context *
+
+ case ARGTYPE_FLOAT:
+ case ARGTYPE_DOUBLE:
+- if (ctx->hardfp) {
++ if (ctx->hardfp && !ctx->in_varargs) {
+ unsigned char *data = value_reserve(valuep, sz);
+ if (data == NULL)
+ return -1;
+@@ -515,3 +516,18 @@ arch_fetch_arg_done(struct fetch_context
+ {
+ free(context);
+ }
++
++int
++arch_fetch_param_pack_start(struct fetch_context *context,
++ enum param_pack_flavor ppflavor)
++{
++ if (ppflavor == PARAM_PACK_VARARGS)
++ context->in_varargs = true;
++ return 0;
++}
++
++void
++arch_fetch_param_pack_end(struct fetch_context *context)
++{
++ context->in_varargs = false;
++}
+Index: b/sysdeps/linux-gnu/arm/arch.h
+===================================================================
+--- a/sysdeps/linux-gnu/arm/arch.h
++++ b/sysdeps/linux-gnu/arm/arch.h
+@@ -35,6 +35,7 @@
+ #define LT_ELF_MACHINE EM_ARM
+
+ #define ARCH_HAVE_FETCH_ARG
++#define ARCH_HAVE_FETCH_PACK
+ #define ARCH_HAVE_BREAKPOINT_DATA
+ struct arch_breakpoint_data {
+ int thumb_mode;
-
--- 0.7.3-6.1/debian/patches/Add-missing-include-stdio.h.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/Add-missing-include-stdio.h.patch 2016-04-07 16:28:21.000000000 +0000
@@ -0,0 +1,30 @@
+Author: dann frazier <dannf@debian.org>
+Description: Add missing #include stdio.h
+ Include stdio.h in files that use fprintf()
+Applied-Upstream: http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commitdiff;h=3c4a0de0be06377caf43a5f9e1682b05ef7299f9
+Last-Update: 2014-03-17
+
+Index: ltrace/sysdeps/linux-gnu/aarch64/regs.c
+===================================================================
+--- ltrace.orig/sysdeps/linux-gnu/aarch64/regs.c 2014-03-12 16:23:25.382866486 -0600
++++ ltrace/sysdeps/linux-gnu/aarch64/regs.c 2014-03-12 16:26:20.989198876 -0600
+@@ -23,6 +23,7 @@
+ #include <linux/uio.h>
+ #include <assert.h>
+ #include <stdlib.h>
++#include <stdio.h>
+
+ #include "backend.h"
+ #include "proc.h"
+Index: ltrace/sysdeps/linux-gnu/aarch64/trace.c
+===================================================================
+--- ltrace.orig/sysdeps/linux-gnu/aarch64/trace.c 2014-03-12 16:23:25.382866486 -0600
++++ ltrace/sysdeps/linux-gnu/aarch64/trace.c 2014-03-12 16:26:20.989198876 -0600
+@@ -23,6 +23,7 @@
+ #include <sys/wait.h>
+ #include <asm/ptrace.h>
+ #include <string.h>
++#include <stdio.h>
+ #include <errno.h>
+
+ #include "backend.h"
-
debian/patches/ppc64el.diff
-
--- 0.7.3-6.1/debian/patches/elf_load_dynamic_entry_4f2f66e6.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/elf_load_dynamic_entry_4f2f66e6.patch 2016-04-08 13:29:18.000000000 +0000
@@ -0,0 +1,153 @@
+From 4f2f66e6abc7fedf3a5d04fab7cc00e5f82b37cf Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Mon, 4 Nov 2013 22:45:34 -0500
+Subject: Move load_dynamic_entry from PPC backend to ltrace-elf.c/.h
+
+---
+ ltrace-elf.c | 32 +++++++++++++++++++++++++++++++
+ ltrace-elf.h | 4 +++
+ sysdeps/linux-gnu/ppc/plt.c | 45 ++++++--------------------------------------
+ 3 files changed, 43 insertions(+), 38 deletions(-)
+
+Index: b/ltrace-elf.c
+===================================================================
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -527,6 +527,38 @@ read_relplt(struct ltelf *lte, Elf_Scn *
+ return 0;
+ }
+
++int
++elf_load_dynamic_entry(struct ltelf *lte, int tag, GElf_Addr *valuep)
++{
++ Elf_Scn *scn;
++ GElf_Shdr shdr;
++ if (elf_get_section_type(lte, SHT_DYNAMIC, &scn, &shdr) < 0
++ || scn == NULL) {
++ fail:
++ fprintf(stderr, "Couldn't get SHT_DYNAMIC: %s\n",
++ elf_errmsg(-1));
++ return -1;
++ }
++
++ Elf_Data *data = elf_loaddata(scn, &shdr);
++ if (data == NULL)
++ goto fail;
++
++ size_t j;
++ for (j = 0; j < shdr.sh_size / shdr.sh_entsize; ++j) {
++ GElf_Dyn dyn;
++ if (gelf_getdyn(data, j, &dyn) == NULL)
++ goto fail;
++
++ if(dyn.d_tag == tag) {
++ *valuep = dyn.d_un.d_ptr;
++ return 0;
++ }
++ }
++
++ return -1;
++}
++
+ static int
+ ltelf_read_elf(struct ltelf *lte, const char *filename)
+ {
+Index: b/ltrace-elf.h
+===================================================================
+--- a/ltrace-elf.h
++++ b/ltrace-elf.h
+@@ -113,6 +113,10 @@ struct elf_each_symbol_t {
+ void *data),
+ void *data);
+
++/* Read a given DT_ TAG from LTE. Value is returned in *VALUEP.
++ * Returns 0 on success or a negative value on failure. */
++int elf_load_dynamic_entry(struct ltelf *lte, int tag, GElf_Addr *valuep);
++
+ /* Read, respectively, 1, 2, 4, or 8 bytes from Elf data at given
+ * OFFSET, and store it in *RETP. Returns 0 on success or a negative
+ * value if there's not enough data. */
+Index: b/sysdeps/linux-gnu/ppc/plt.c
+===================================================================
+--- a/sysdeps/linux-gnu/ppc/plt.c
++++ b/sysdeps/linux-gnu/ppc/plt.c
+@@ -441,38 +441,6 @@ get_glink_vma(struct ltelf *lte, GElf_Ad
+ }
+
+ static int
+-load_dynamic_entry(struct ltelf *lte, int tag, GElf_Addr *valuep)
+-{
+- Elf_Scn *scn;
+- GElf_Shdr shdr;
+- if (elf_get_section_type(lte, SHT_DYNAMIC, &scn, &shdr) < 0
+- || scn == NULL) {
+- fail:
+- fprintf(stderr, "Couldn't get SHT_DYNAMIC: %s\n",
+- elf_errmsg(-1));
+- return -1;
+- }
+-
+- Elf_Data *data = elf_loaddata(scn, &shdr);
+- if (data == NULL)
+- goto fail;
+-
+- size_t j;
+- for (j = 0; j < shdr.sh_size / shdr.sh_entsize; ++j) {
+- GElf_Dyn dyn;
+- if (gelf_getdyn(data, j, &dyn) == NULL)
+- goto fail;
+-
+- if(dyn.d_tag == tag) {
+- *valuep = dyn.d_un.d_ptr;
+- return 0;
+- }
+- }
+-
+- return -1;
+-}
+-
+-static int
+ nonzero_data(Elf_Data *data)
+ {
+ /* We are not supposed to get here if there's no PLT. */
+@@ -520,7 +488,7 @@ arch_elf_init(struct ltelf *lte, struct
+
+ if (lte->ehdr.e_machine == EM_PPC && lte->arch.secure_plt) {
+ GElf_Addr ppcgot;
+- if (load_dynamic_entry(lte, DT_PPC_GOT, &ppcgot) < 0) {
++ if (elf_load_dynamic_entry(lte, DT_PPC_GOT, &ppcgot) < 0) {
+ fprintf(stderr, "couldn't find DT_PPC_GOT\n");
+ return -1;
+ }
+@@ -533,7 +501,8 @@ arch_elf_init(struct ltelf *lte, struct
+
+ } else if (lte->ehdr.e_machine == EM_PPC64) {
+ GElf_Addr glink_vma;
+- if (load_dynamic_entry(lte, DT_PPC64_GLINK, &glink_vma) < 0) {
++ if (elf_load_dynamic_entry(lte, DT_PPC64_GLINK,
++ &glink_vma) < 0) {
+ fprintf(stderr, "couldn't find DT_PPC64_GLINK\n");
+ return -1;
+ }
+@@ -543,8 +512,8 @@ arch_elf_init(struct ltelf *lte, struct
+
+ } else {
+ /* By exhaustion--PPC32 BSS. */
+- if (load_dynamic_entry(lte, DT_PLTGOT,
+- &lib->arch.pltgot_addr) < 0) {
++ if (elf_load_dynamic_entry(lte, DT_PLTGOT,
++ &lib->arch.pltgot_addr) < 0) {
+ fprintf(stderr, "couldn't find DT_PLTGOT\n");
+ return -1;
+ }
+@@ -639,8 +608,8 @@ arch_elf_init(struct ltelf *lte, struct
+ Elf_Scn *rela_sec;
+ GElf_Shdr rela_shdr;
+ if (lte->ehdr.e_machine == EM_PPC64
+- && load_dynamic_entry(lte, DT_RELA, &rela) == 0
+- && load_dynamic_entry(lte, DT_RELASZ, &relasz) == 0
++ && elf_load_dynamic_entry(lte, DT_RELA, &rela) == 0
++ && elf_load_dynamic_entry(lte, DT_RELASZ, &relasz) == 0
+ && elf_get_section_covering(lte, rela, &rela_sec, &rela_shdr) == 0
+ && rela_sec != NULL) {
+
-
--- 0.7.3-6.1/debian/patches/add-missing-stdint.h-include.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/add-missing-stdint.h-include.patch 2016-04-07 16:28:22.000000000 +0000
@@ -0,0 +1,20 @@
+Author: dann frazier <dannf@debian.org>
+Description: add missing <stdint.h> include
+ aarch64's fetch.c uses the uintptr_t typedef defined by stdint.h without
+ including it. This doesn't currently cause a build failure because stdint.h
+ is indirectly included via proc.h.
+Applied-Upstream: http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commitdiff;h=e9919d980a5b6fc2417d7c05d46329b442467940
+Last-Update: 2014-03-17
+
+Index: ltrace/sysdeps/linux-gnu/aarch64/fetch.c
+===================================================================
+--- ltrace.orig/sysdeps/linux-gnu/aarch64/fetch.c 2014-03-12 16:23:25.382866486 -0600
++++ ltrace/sysdeps/linux-gnu/aarch64/fetch.c 2014-03-12 16:25:38.492638417 -0600
+@@ -22,6 +22,7 @@
+ #include <asm/ptrace.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <stdint.h>
+
+ #include "fetch.h"
+ #include "proc.h"
-
--- 0.7.3-6.1/debian/patches/arm_fetch_backend_97a25160.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/arm_fetch_backend_97a25160.patch 2016-04-11 16:11:40.000000000 +0000
@@ -0,0 +1,174 @@
+From 97a25160b0fe646d9c567e12c5abefe8e59873c2 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Tue, 5 Feb 2013 03:30:11 +0100
+Subject: Add ARM fetch backend
+
+This only properly decodes float and double return values. More to come.
+---
+ sysdeps/linux-gnu/arm/fetch.c | 104 ++++++++++++++++++++++++++++++++++++++++++
+ sysdeps/linux-gnu/arm/trace.c | 43 -----------------
+ 2 files changed, 104 insertions(+), 43 deletions(-)
+
+Index: b/sysdeps/linux-gnu/arm/fetch.c
+===================================================================
+--- a/sysdeps/linux-gnu/arm/fetch.c
++++ b/sysdeps/linux-gnu/arm/fetch.c
+@@ -222,3 +222,107 @@ arch_library_clone(struct library *retp,
+ {
+ retp->arch = lib->arch;
+ }
++
++struct fetch_context {
++ struct pt_regs regs;
++ struct {
++ union {
++ double d[32];
++ float s[64];
++ };
++ uint32_t fpscr;
++ } fpregs;
++ bool hardfp:1;
++};
++
++static int
++fetch_register_banks(struct Process *proc, struct fetch_context *context)
++{
++ if (context->hardfp
++ && ptrace(PTRACE_GETVFPREGS, proc->pid,
++ NULL, &context->fpregs) == -1)
++ return -1;
++
++ return 0;
++}
++
++struct fetch_context *
++arch_fetch_arg_init(enum tof type, struct Process *proc,
++ struct arg_type_info *ret_info)
++{
++ struct fetch_context *context = malloc(sizeof(*context));
++ context->hardfp = proc->libraries->arch.hardfp;
++ if (context == NULL
++ || fetch_register_banks(proc, context) < 0) {
++ free(context);
++ return NULL;
++ }
++
++ return context;
++}
++
++struct fetch_context *
++arch_fetch_arg_clone(struct Process *proc,
++ struct fetch_context *context)
++{
++ struct fetch_context *clone = malloc(sizeof(*context));
++ if (clone == NULL)
++ return NULL;
++ *clone = *context;
++ return clone;
++}
++
++int
++arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
++ struct Process *proc,
++ struct arg_type_info *info, struct value *valuep)
++{
++ return 0;
++}
++
++int
++arch_fetch_retval(struct fetch_context *ctx, enum tof type,
++ struct Process *proc, struct arg_type_info *info,
++ struct value *valuep)
++{
++ if (fetch_register_banks(proc, ctx) < 0)
++ return -1;
++
++ switch (info->type) {
++ case ARGTYPE_VOID:
++ return 0;
++
++ case ARGTYPE_FLOAT:
++ case ARGTYPE_DOUBLE:
++ if (ctx->hardfp) {
++ size_t sz = type_sizeof(proc, info);
++ assert(sz != (size_t)-1);
++ unsigned char *data = value_reserve(valuep, sz);
++ if (data == NULL)
++ return -1;
++ memmove(data, &ctx->fpregs, sz);
++ return 0;
++ }
++ /* Fall through. */
++
++ case ARGTYPE_CHAR:
++ case ARGTYPE_SHORT:
++ case ARGTYPE_USHORT:
++ case ARGTYPE_INT:
++ case ARGTYPE_UINT:
++ case ARGTYPE_LONG:
++ case ARGTYPE_ULONG:
++ case ARGTYPE_POINTER:
++ case ARGTYPE_ARRAY:
++ case ARGTYPE_STRUCT:
++ return -1;
++ }
++ assert(info->type != info->type);
++ abort();
++}
++
++void
++arch_fetch_arg_done(struct fetch_context *context)
++{
++ free(context);
++}
+Index: b/sysdeps/linux-gnu/arm/trace.c
+===================================================================
+--- a/sysdeps/linux-gnu/arm/trace.c
++++ b/sysdeps/linux-gnu/arm/trace.c
+@@ -103,46 +103,3 @@ syscall_p(Process *proc, int status, int
+ return 0;
+ }
+
+-long
+-gimme_arg(enum tof type, Process *proc, int arg_num, struct arg_type_info *info)
+-{
+- proc_archdep *a = (proc_archdep *) proc->arch_ptr;
+-
+- if (arg_num == -1) { /* return value */
+- return ptrace(PTRACE_PEEKUSER, proc->pid, off_r0, 0);
+- }
+-
+- /* deal with the ARM calling conventions */
+- if (type == LT_TOF_FUNCTION || type == LT_TOF_FUNCTIONR) {
+- if (arg_num < 4) {
+- if (a->valid && type == LT_TOF_FUNCTION)
+- return a->regs.uregs[arg_num];
+- if (a->valid && type == LT_TOF_FUNCTIONR)
+- return a->func_arg[arg_num];
+- return ptrace(PTRACE_PEEKUSER, proc->pid,
+- (void *)(4 * arg_num), 0);
+- } else {
+- return ptrace(PTRACE_PEEKDATA, proc->pid,
+- proc->stack_pointer + 4 * (arg_num - 4),
+- 0);
+- }
+- } else if (type == LT_TOF_SYSCALL || type == LT_TOF_SYSCALLR) {
+- if (arg_num < 5) {
+- if (a->valid && type == LT_TOF_SYSCALL)
+- return a->regs.uregs[arg_num];
+- if (a->valid && type == LT_TOF_SYSCALLR)
+- return a->sysc_arg[arg_num];
+- return ptrace(PTRACE_PEEKUSER, proc->pid,
+- (void *)(4 * arg_num), 0);
+- } else {
+- return ptrace(PTRACE_PEEKDATA, proc->pid,
+- proc->stack_pointer + 4 * (arg_num - 5),
+- 0);
+- }
+- } else {
+- fprintf(stderr, "gimme_arg called with wrong arguments\n");
+- exit(1);
+- }
+-
+- return 0;
+-}
-
--- 0.7.3-6.1/debian/patches/add_elf_read_u8_3c636fb7.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/add_elf_read_u8_3c636fb7.patch 2016-04-08 02:27:14.000000000 +0000
@@ -0,0 +1,40 @@
+From 3c636fb789a29cac0c8f7f0982fb17afeee489dc Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Tue, 5 Feb 2013 01:48:54 +0100
+Subject: Add elf_read_u8
+
+---
+ ltrace-elf.c | 1 +
+ ltrace-elf.h | 7 ++++---
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+Index: b/ltrace-elf.c
+===================================================================
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -235,6 +235,7 @@ need_data(Elf_Data *data, GElf_Xword off
+ return 0; \
+ }
+
++DEF_READER(elf_read_u8, 8)
+ DEF_READER(elf_read_u16, 16)
+ DEF_READER(elf_read_u32, 32)
+ DEF_READER(elf_read_u64, 64)
+Index: b/ltrace-elf.h
+===================================================================
+--- a/ltrace-elf.h
++++ b/ltrace-elf.h
+@@ -101,9 +101,10 @@ int elf_get_section_type(struct ltelf *l
+ int elf_get_section_named(struct ltelf *lte, const char *name,
+ Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr);
+
+-/* Read, respectively, 2, 4, or 8 bytes from Elf data at given OFFSET,
+- * and store it in *RETP. Returns 0 on success or a negative value if
+- * there's not enough data. */
++/* Read, respectively, 1, 2, 4, or 8 bytes from Elf data at given
++ * OFFSET, and store it in *RETP. Returns 0 on success or a negative
++ * value if there's not enough data. */
++int elf_read_u8(Elf_Data *data, GElf_Xword offset, uint8_t *retp);
+ int elf_read_u16(Elf_Data *data, GElf_Xword offset, uint16_t *retp);
+ int elf_read_u32(Elf_Data *data, GElf_Xword offset, uint32_t *retp);
+ int elf_read_u64(Elf_Data *data, GElf_Xword offset, uint64_t *retp);
-
--- 0.7.3-6.1/debian/patches/series 2016-09-21 11:15:35.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/series 2018-08-22 10:15:44.000000000 +0000
@@ -5,4 +5,34 @@
05-sparc-ftbfs
06-unexpected-breakpoint
gcc-5.diff
+ptrace.diff
+add_irelative_tracing_b420a226.patch
+find_irelative_b061bae3.patch
+keep_plt_reloc_in_vector_673ff510.patch
+add_elf_read_u8_3c636fb7.patch
+add_elf_read_next_u_439ab5bf.patch
+add_elf_can_read_next_5c37171a.patch
+add_elf_each_symbol_7a29f9e7.patch
+elf_read_uleb128_184779e4.patch
+arm_attr_decoding_df7d2311.patch
+arm_fetch_backend_97a25160.patch
+arm_bpc_62fc7747.patch
+arm_vfp_params_1c8596d4.patch
+arm_vararg_without_vfp_88a0fe50.patch
+arm_backend_fixes_1383e5bd.patch
+jmp_irel.patch
+elf_load_dynamic_entry_4f2f66e6.patch
+arm_plt_rel_9e33f5ac.patch
+dont_ltelf_destroy_if_init_fails_0ba3c5ee.patch
+ppc64el.diff
+ppc64le-fixes.patch
+ppc64-fork.patch
+on_install_breakpoint_56134ff5.patch
+ppc64-unprelink.patch
+ppc-bias.patch
+Move-get_hfa_type-from-IA64-backend-to-type.c-name-i.patch
+Set-child-stack-alignment-in-trace-clone.c.patch
+Implement-aarch64-support.patch
+add-missing-stdint.h-include.patch
+Add-missing-include-stdio.h.patch
deprecated-readdir_r.diff
-
debian/patches/arm_bpc_62fc7747.patch
-
--- 0.7.3-6.1/debian/patches/ppc-bias.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/ppc-bias.patch 2016-04-08 02:38:21.000000000 +0000
@@ -0,0 +1,134 @@
+From: Petr Machata <pmachata@redhat.com>
+Subject: Fix bias handling in PPC backend
+Last-Update: 2016-04-06
+
+This is a backport of the following upstream commits:
+ - bf821009: Fix address biasing in PPC backend
+ - d80c5371: Fix cloning of PPC_PLT_NEED_UNRESOLVE breakpoints
+ - d8f1287b: Nits
+
+It was taken from the fedoraproject pkgs ltrace repository:
+http://pkgs.fedoraproject.org/cgit/rpms/ltrace.git/commit/?id=5f8efb0257eaa772639d5a4912a6b5e3a709ceab
+
+The original changelog in fedora spec mentioned:
+
+"""
+# https://bugzilla.redhat.com/show_bug.cgi?id=1171165
+# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=d8f1287b85e2c2b2ae0235809e956f4365e53c45
+# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=d80c5371454383e3f9978622e5578cf02af8c44c
+# http://anonscm.debian.org/cgit/collab-maint/ltrace.git/commit/?id=bf82100966deda9c7d26ad085d97c08126a8ae88
+Patch16: ltrace-0.7.91-ppc-bias.patch
+
+[...]
+
+ * Tue Dec 9 2014 Petr Machata <pmachata@redhat.com> - 0.7.91-11
+ - Fix bias handling in PPC backend
+ - Fix cloning of unresolved breakpoints in PPC backend
+ (ltrace-0.7.91-ppc-bias.patch)
+
+"""
+
+This is Patch16; aka ltrace-0.7.91-ppc-bias.patch
+
+It was refreshed (backported, if you will) for applying on 0.7.3 by:
+Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
+
+It is attributed to Petr Machata since there were no origin markings on the
+original patch and he did the commit. If that's not correct, we can fix the
+attribution when someone speaks up.
+
+---
+ sysdeps/linux-gnu/ppc/plt.c | 36 +++++++++++++++++++++++-------------
+ 1 file changed, 23 insertions(+), 13 deletions(-)
+
+Index: b/sysdeps/linux-gnu/ppc/plt.c
+===================================================================
+--- a/sysdeps/linux-gnu/ppc/plt.c
++++ b/sysdeps/linux-gnu/ppc/plt.c
+@@ -309,14 +309,15 @@ arch_plt_sym_val(struct ltelf *lte, size
+
+ assert(rela->r_addend != 0);
+ /* XXX double cast */
+- arch_addr_t res_addr = (arch_addr_t) (uintptr_t) rela->r_addend;
++ arch_addr_t res_addr
++ = (arch_addr_t) (uintptr_t) (rela->r_addend + lte->bias);
+ if (arch_translate_address(lte, res_addr, &res_addr) < 0) {
+ fprintf(stderr, "Couldn't OPD-translate IRELATIVE "
+ "resolver address.\n");
+ return 0;
+ }
+ /* XXX double cast */
+- return (GElf_Addr) (uintptr_t) res_addr;
++ return (GElf_Addr) (uintptr_t) (res_addr - lte->bias);
+
+ } else {
+ /* We put brakpoints to PLT entries the same as the
+@@ -518,7 +519,7 @@ arch_elf_init(struct ltelf *lte, struct
+ #ifndef EF_PPC64_ABI
+ assert (! (lte->ehdr.e_flags & 3 ) == 2)
+ #else
+- lte->arch.elfv2_abi=((lte->ehdr.e_flags & EF_PPC64_ABI) == 2) ;
++ lte->arch.elfv2_abi = ((lte->ehdr.e_flags & EF_PPC64_ABI) == 2);
+ #endif
+
+ if (lte->ehdr.e_machine == EM_PPC64
+@@ -792,15 +793,15 @@ arch_elf_add_plt_entry(struct Process *p
+ assert(plt_slot_addr >= lte->plt_addr
+ || plt_slot_addr < lte->plt_addr + lte->plt_size);
+
++ plt_entry_addr += lte->bias;
++ plt_slot_addr += lte->bias;
++
+ /* Should avoid to do read if dynamic linker hasn't run yet
+ * or allow -1 a valid return code. */
+ GElf_Addr plt_slot_value;
+- if (read_plt_slot_value(proc, plt_slot_addr, &plt_slot_value) < 0) {
+- if (!lte->arch.elfv2_abi)
+- goto fail;
+- else
+- return PPC_PLT_UNRESOLVED;
+- }
++ int rc = read_plt_slot_value(proc, plt_slot_addr, &plt_slot_value);
++ if (rc < 0 && !lte->arch.elfv2_abi)
++ goto fail;
+
+ struct library_symbol *libsym = malloc(sizeof(*libsym));
+ if (libsym == NULL) {
+@@ -820,8 +821,9 @@ arch_elf_add_plt_entry(struct Process *p
+ goto fail;
+ libsym->arch.plt_slot_addr = plt_slot_addr;
+
+- if (! is_irelative
+- && (plt_slot_value == plt_entry_addr || plt_slot_value == 0)) {
++ if (rc < 0 || (! is_irelative
++ && (plt_slot_value == plt_entry_addr
++ || plt_slot_value == 0))) {
+ libsym->arch.type = PPC_PLT_UNRESOLVED;
+ libsym->arch.resolved_value = plt_entry_addr;
+ } else {
+@@ -1147,8 +1149,8 @@ ppc_plt_bp_install(struct breakpoint *bp
+ libsym->arch.resolved_value = plt_entry_addr;
+ }
+ } else {
+- fprintf(stderr, "Couldn't unresolve %s@%p. Not tracing"
+- " this symbol.\n",
++ fprintf(stderr, "Couldn't unresolve %s@%p. Will not"
++ " trace this symbol.\n",
+ breakpoint_name(bp), bp->addr);
+ proc_remove_breakpoint(proc, bp);
+ }
+@@ -1186,6 +1188,14 @@ arch_library_symbol_clone(struct library
+ struct library_symbol *libsym)
+ {
+ retp->arch = libsym->arch;
++ if (libsym->arch.type == PPC_PLT_NEED_UNRESOLVE) {
++ assert(libsym->arch.data->self == libsym->arch.data);
++ retp->arch.data = malloc(sizeof *retp->arch.data);
++ if (retp->arch.data == NULL)
++ return -1;
++ *retp->arch.data = *libsym->arch.data;
++ retp->arch.data->self = retp->arch.data;
++ }
+ return 0;
+ }
+
-
--- 0.7.3-6.1/debian/patches/ppc64-fork.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/ppc64-fork.patch 2016-04-07 23:33:55.000000000 +0000
@@ -0,0 +1,49 @@
+From 35742523e3daa0e59de0c1c3fdd8e5ff52891967 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Thu, 9 Jan 2014 23:41:50 +0100
+Subject: [PATCH] Fix a problem in tracing across fork on PPC64
+
+In order to avoid single-stepping through large portions of the
+dynamic linker, ltrace remembers at which address the instruction that
+resolved a PLT slot is. It then puts a breakpoint to this address so
+that it can fast-forward to that address next time it needs to catch a
+PLT slot being resolved.
+
+When a process is cloned, the pointer to this breakpoint is simply
+copied over to the new process, instead of being looked up in the new
+process structures. This patches fixes this.
+---
+ sysdeps/linux-gnu/ppc/plt.c | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+Index: b/sysdeps/linux-gnu/ppc/plt.c
+===================================================================
+--- a/sysdeps/linux-gnu/ppc/plt.c
++++ b/sysdeps/linux-gnu/ppc/plt.c
+@@ -1,6 +1,6 @@
+ /*
+ * This file is part of ltrace.
+- * Copyright (C) 2012 Petr Machata, Red Hat Inc.
++ * Copyright (C) 2012,2013,2014 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2004,2008,2009 Juan Cespedes
+ * Copyright (C) 2006 Paul Gilliam
+ *
+@@ -1201,6 +1201,18 @@ int
+ arch_process_clone(struct Process *retp, struct Process *proc)
+ {
+ retp->arch = proc->arch;
++
++ if (retp->arch.dl_plt_update_bp != NULL) {
++ /* Point it to the corresponding breakpoint in RETP.
++ * It must be there, this part of PROC has already
++ * been cloned to RETP. */
++ retp->arch.dl_plt_update_bp
++ = address2bpstruct(retp,
++ retp->arch.dl_plt_update_bp->addr);
++
++ assert(retp->arch.dl_plt_update_bp != NULL);
++ }
++
+ return 0;
+ }
+
-
debian/patches/ppc64-unprelink.patch
-
--- 0.7.3-6.1/debian/patches/Move-get_hfa_type-from-IA64-backend-to-type.c-name-i.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/Move-get_hfa_type-from-IA64-backend-to-type.c-name-i.patch 2016-04-07 16:28:21.000000000 +0000
@@ -0,0 +1,163 @@
+Author: Petr Machata <pmachata@apm-mustang-ev2-02.ml3.eng.bos.redhat.com>
+Description: Move get_hfa_type from IA64 backend to type.c, name it type_get_hfa_type
+Applied-Upstream: http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commit;h=982cbca34b2b49a158086ff5f43eb9bba89edead
+Last-Update: 2014-03-13
+
+Index: ltrace/sysdeps/linux-gnu/ia64/fetch.c
+===================================================================
+--- ltrace.orig/sysdeps/linux-gnu/ia64/fetch.c 2014-03-12 16:13:44.075726000 -0600
++++ ltrace/sysdeps/linux-gnu/ia64/fetch.c 2014-03-13 09:32:30.504762084 -0600
+@@ -1,6 +1,6 @@
+ /*
+ * This file is part of ltrace.
+- * Copyright (C) 2012 Petr Machata, Red Hat Inc.
++ * Copyright (C) 2012,2013 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2008,2009 Juan Cespedes
+ * Copyright (C) 2006 Steve Fink
+ * Copyright (C) 2006 Ian Wienand
+@@ -249,37 +249,6 @@
+ return 0;
+ }
+
+-static enum arg_type
+-get_hfa_type(struct arg_type_info *info, size_t *countp)
+-{
+- size_t n = type_aggregate_size(info);
+- if (n == (size_t)-1)
+- return ARGTYPE_VOID;
+-
+- enum arg_type type = ARGTYPE_VOID;
+- *countp = 0;
+-
+- while (n-- > 0) {
+- struct arg_type_info *emt = type_element(info, n);
+-
+- enum arg_type emt_type = emt->type;
+- size_t emt_count = 1;
+- if (emt_type == ARGTYPE_STRUCT || emt_type == ARGTYPE_ARRAY)
+- emt_type = get_hfa_type(emt, &emt_count);
+-
+- if (type == ARGTYPE_VOID) {
+- if (emt_type != ARGTYPE_FLOAT
+- && emt_type != ARGTYPE_DOUBLE)
+- return ARGTYPE_VOID;
+- type = emt_type;
+- }
+- if (emt_type != type)
+- return ARGTYPE_VOID;
+- *countp += emt_count;
+- }
+- return type;
+-}
+-
+ static int
+ allocate_hfa(struct fetch_context *ctx, struct Process *proc,
+ struct arg_type_info *info, struct value *valuep,
+@@ -380,10 +349,11 @@
+ * floating-point registers, beginning with f8. */
+ if (info->type == ARGTYPE_STRUCT || info->type == ARGTYPE_ARRAY) {
+ size_t hfa_size;
+- enum arg_type hfa_type = get_hfa_type(info, &hfa_size);
+- if (hfa_type != ARGTYPE_VOID && hfa_size <= 8)
++ struct arg_type_info *hfa_info
++ = type_get_hfa_type(info, &hfa_size);
++ if (hfa_info != NULL && hfa_size <= 8)
+ return allocate_hfa(ctx, proc, info, valuep,
+- hfa_type, hfa_size);
++ hfa_info->type, hfa_size);
+ }
+
+ /* Integers and pointers are passed in r8. 128-bit integers
+@@ -409,7 +379,7 @@
+ struct arg_type_info *info, struct value *valuep)
+ {
+ switch (info->type) {
+- enum arg_type hfa_type;
++ struct arg_type_info *hfa_info;
+ size_t hfa_size;
+
+ case ARGTYPE_VOID:
+@@ -421,10 +391,10 @@
+ return allocate_float(ctx, proc, info, valuep, 1);
+
+ case ARGTYPE_STRUCT:
+- hfa_type = get_hfa_type(info, &hfa_size);
+- if (hfa_type != ARGTYPE_VOID)
++ hfa_info = type_get_hfa_type(info, &hfa_size);
++ if (hfa_info != NULL)
+ return allocate_hfa(ctx, proc, info, valuep,
+- hfa_type, hfa_size);
++ hfa_info->type, hfa_size);
+ /* Fall through. */
+ case ARGTYPE_CHAR:
+ case ARGTYPE_SHORT:
+Index: ltrace/type.c
+===================================================================
+--- ltrace.orig/type.c 2014-03-12 16:13:44.075726000 -0600
++++ ltrace/type.c 2014-03-13 09:32:30.504762084 -0600
+@@ -568,3 +568,39 @@
+ }
+ abort();
+ }
++
++struct arg_type_info *
++type_get_hfa_type(struct arg_type_info *info, size_t *countp)
++{
++ assert(info != NULL);
++ if (info->type != ARGTYPE_STRUCT
++ && info->type != ARGTYPE_ARRAY)
++ return NULL;
++
++ size_t n = type_aggregate_size(info);
++ if (n == (size_t)-1)
++ return NULL;
++
++ struct arg_type_info *ret = NULL;
++ *countp = 0;
++
++ while (n-- > 0) {
++ struct arg_type_info *emt = type_element(info, n);
++
++ size_t emt_count = 1;
++ if (emt->type == ARGTYPE_STRUCT || emt->type == ARGTYPE_ARRAY)
++ emt = type_get_hfa_type(emt, &emt_count);
++ if (emt == NULL)
++ return NULL;
++ if (ret == NULL) {
++ if (emt->type != ARGTYPE_FLOAT
++ && emt->type != ARGTYPE_DOUBLE)
++ return NULL;
++ ret = emt;
++ }
++ if (emt->type != ret->type)
++ return NULL;
++ *countp += emt_count;
++ }
++ return ret;
++}
+Index: ltrace/type.h
+===================================================================
+--- ltrace.orig/type.h 2014-03-12 16:13:44.075726000 -0600
++++ ltrace/type.h 2014-03-13 09:32:30.504762084 -0600
+@@ -1,6 +1,6 @@
+ /*
+ * This file is part of ltrace.
+- * Copyright (C) 2011,2012 Petr Machata, Red Hat Inc.
++ * Copyright (C) 2011,2012,2013 Petr Machata, Red Hat Inc.
+ * Copyright (C) 1997-2009 Juan Cespedes
+ *
+ * This program is free software; you can redistribute it and/or
+@@ -142,4 +142,13 @@
+ * type. */
+ struct arg_type_info *type_get_fp_equivalent(struct arg_type_info *info);
+
++/* If INFO is homogeneous floating-point aggregate, return the
++ * corresponding floating point type, and set *COUNTP to number of
++ * fields of the structure. Otherwise return NULL. INFO is a HFA if
++ * it's an aggregate whose each field is either a HFA, or a
++ * floating-point type. */
++struct arg_type_info *type_get_hfa_type(struct arg_type_info *info,
++ size_t *countp);
++
++
+ #endif /* TYPE_H */
-
--- 0.7.3-6.1/debian/patches/dont_ltelf_destroy_if_init_fails_0ba3c5ee.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/dont_ltelf_destroy_if_init_fails_0ba3c5ee.patch 2016-04-07 16:28:21.000000000 +0000
@@ -0,0 +1,30 @@
+From 0ba3c5eee259b77e3883e40c4d0cd2fab5b03ff3 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Mon, 11 Nov 2013 02:27:08 +0100
+Subject: In ltrace_init, don't call ltelf_destroy if ltelf_init fails
+
+---
+ libltrace.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+Index: b/libltrace.c
+===================================================================
+--- a/libltrace.c
++++ b/libltrace.c
+@@ -136,9 +136,13 @@ ltrace_init(int argc, char **argv) {
+ if (command) {
+ /* Check that the binary ABI is supported before
+ * calling execute_program. */
+- struct ltelf lte;
+- ltelf_init(<e, command);
+- ltelf_destroy(<e);
++ {
++ struct ltelf lte;
++ if (ltelf_init(<e, command) == 0)
++ ltelf_destroy(<e);
++ else
++ exit(EXIT_FAILURE);
++ }
+
+ pid_t pid = execute_program(command, argv);
+ struct Process *proc = open_program(command, pid);
-
--- 0.7.3-6.1/debian/patches/add_elf_each_symbol_7a29f9e7.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/add_elf_each_symbol_7a29f9e7.patch 2016-04-08 02:28:05.000000000 +0000
@@ -0,0 +1,111 @@
+From 7a29f9e7a2bd5849886519eb82e9c043d24c6a40 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Mon, 14 Oct 2013 20:04:09 +0200
+Subject: Add elf_each_symbol
+
+---
+ ltrace-elf.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ ltrace-elf.h | 12 +++++++++++
+ 2 files changed, 72 insertions(+)
+
+Index: b/ltrace-elf.c
+===================================================================
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -190,6 +190,66 @@ name_p(Elf_Scn *scn, GElf_Shdr *shdr, vo
+ return strcmp(name, data->name) == 0;
+ }
+
++static struct elf_each_symbol_t
++each_symbol_in(Elf_Data *symtab, const char *strtab, size_t count,
++ unsigned i,
++ enum callback_status (*cb)(GElf_Sym *symbol,
++ const char *name, void *data),
++ void *data)
++{
++ for (; i < count; ++i) {
++ GElf_Sym sym;
++ if (gelf_getsym(symtab, i, &sym) == NULL)
++ return (struct elf_each_symbol_t){ i, -2 };
++
++ switch (cb(&sym, strtab + sym.st_name, data)) {
++ case CBS_FAIL:
++ return (struct elf_each_symbol_t){ i, -1 };
++ case CBS_STOP:
++ return (struct elf_each_symbol_t){ i + 1, 0 };
++ case CBS_CONT:
++ break;
++ }
++ }
++
++ return (struct elf_each_symbol_t){ 0, 0 };
++}
++
++/* N.B.: gelf_getsym takes integer argument. Since negative values
++ * are invalid as indices, we can use the extra bit to encode which
++ * symbol table we are looking into. ltrace currently doesn't handle
++ * more than two symbol tables anyway, nor does it handle the xindex
++ * stuff. */
++struct elf_each_symbol_t
++elf_each_symbol(struct ltelf *lte, unsigned start_after,
++ enum callback_status (*cb)(GElf_Sym *symbol,
++ const char *name, void *data),
++ void *data)
++{
++ unsigned index = start_after == 0 ? 0 : start_after >> 1;
++
++ /* Go through static symbol table first. */
++ if ((start_after & 0x1) == 0) {
++ struct elf_each_symbol_t st
++ = each_symbol_in(lte->symtab, lte->strtab,
++ lte->symtab_count, index, cb, data);
++
++ /* If the iteration stopped prematurely, bail out. */
++ if (st.restart != 0)
++ return ((struct elf_each_symbol_t)
++ { st.restart << 1, st.status });
++ }
++
++ struct elf_each_symbol_t st
++ = each_symbol_in(lte->dynsym, lte->dynstr, lte->dynsym_count,
++ index, cb, data);
++ if (st.restart != 0)
++ return ((struct elf_each_symbol_t)
++ { st.restart << 1 | 0x1, st.status });
++
++ return (struct elf_each_symbol_t){ 0, 0 };
++}
++
+ int
+ elf_get_section_named(struct ltelf *lte, const char *name,
+ Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr)
+Index: b/ltrace-elf.h
+===================================================================
+--- a/ltrace-elf.h
++++ b/ltrace-elf.h
+@@ -26,6 +26,7 @@
+
+ #include <gelf.h>
+ #include <stdlib.h>
++#include <callback.h>
+ #include "sysdep.h"
+ #include "vect.h"
+
+@@ -101,6 +102,17 @@ int elf_get_section_type(struct ltelf *l
+ int elf_get_section_named(struct ltelf *lte, const char *name,
+ Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr);
+
++/* Iterate through all symbols in LTE. See callback.h for notes on
++ * iteration interfaces. START_AFTER is 0 in initial call. */
++struct elf_each_symbol_t {
++ unsigned restart;
++ int status;
++} elf_each_symbol(struct ltelf *lte, unsigned start_after,
++ enum callback_status (*cb)(GElf_Sym *symbol,
++ const char *name,
++ void *data),
++ void *data);
++
+ /* Read, respectively, 1, 2, 4, or 8 bytes from Elf data at given
+ * OFFSET, and store it in *RETP. Returns 0 on success or a negative
+ * value if there's not enough data. */
-
--- 0.7.3-6.1/debian/patches/add_elf_can_read_next_5c37171a.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/add_elf_can_read_next_5c37171a.patch 2016-04-08 02:27:36.000000000 +0000
@@ -0,0 +1,57 @@
+From 5c37171a18bddfbc716d4f3da8b008a844eea4f7 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Tue, 5 Feb 2013 01:52:37 +0100
+Subject: Add elf_can_read_next
+
+---
+ ltrace-elf.c | 10 +++++-----
+ ltrace-elf.h | 3 +++
+ 2 files changed, 8 insertions(+), 5 deletions(-)
+
+Index: b/ltrace-elf.c
+===================================================================
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -202,23 +202,23 @@ elf_get_section_named(struct ltelf *lte,
+ &name_p, &data);
+ }
+
+-static int
+-need_data(Elf_Data *data, GElf_Xword offset, GElf_Xword size)
++int
++elf_can_read_next(Elf_Data *data, GElf_Xword offset, GElf_Xword size)
+ {
+ assert(data != NULL);
+ if (data->d_size < size || offset > data->d_size - size) {
+ debug(1, "Not enough data to read %"PRId64"-byte value"
+ " at offset %"PRId64".", size, offset);
+- return -1;
++ return 0;
+ }
+- return 0;
++ return 1;
+ }
+
+ #define DEF_READER(NAME, SIZE) \
+ int \
+ NAME(Elf_Data *data, GElf_Xword offset, uint##SIZE##_t *retp) \
+ { \
+- if (need_data(data, offset, SIZE / 8) < 0) \
++ if (!elf_can_read_next(data, offset, SIZE / 8)) \
+ return -1; \
+ \
+ if (data->d_buf == NULL) /* NODATA section */ { \
+Index: b/ltrace-elf.h
+===================================================================
+--- a/ltrace-elf.h
++++ b/ltrace-elf.h
+@@ -116,6 +116,9 @@ int elf_read_next_u16(Elf_Data *data, GE
+ int elf_read_next_u32(Elf_Data *data, GElf_Xword *offset, uint32_t *retp);
+ int elf_read_next_u64(Elf_Data *data, GElf_Xword *offset, uint64_t *retp);
+
++/* Return whether there's AMOUNT more bytes after OFFSET in DATA. */
++int elf_can_read_next(Elf_Data *data, GElf_Xword offset, GElf_Xword amount);
++
+ #if __WORDSIZE == 32
+ #define PRI_ELF_ADDR PRIx32
+ #define GELF_ADDR_CAST(x) (void *)(uint32_t)(x)
-
--- 0.7.3-6.1/debian/patches/ptrace.diff 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/ptrace.diff 2016-04-07 16:28:22.000000000 +0000
@@ -0,0 +1,68 @@
+Description: try to make PTRACE scope sysctl more discoverable.
+Updated: 2014-05-07
+
+Index: ltrace-0.7.3/sysdeps/linux-gnu/trace.c
+===================================================================
+--- ltrace-0.7.3.orig/sysdeps/linux-gnu/trace.c 2014-05-07 15:17:07.949872643 -0400
++++ ltrace-0.7.3/sysdeps/linux-gnu/trace.c 2014-05-07 15:24:08.077866134 -0400
+@@ -49,7 +49,7 @@
+ #include "type.h"
+
+ void
+-trace_fail_warning(pid_t pid)
++trace_fail_warning(pid_t pid, int err)
+ {
+ /* This was adapted from GDB. */
+ #ifdef HAVE_LIBSELINUX
+@@ -66,6 +66,11 @@
+ "tracing other processes. You can disable this process attach protection by\n"
+ "issuing 'setsebool deny_ptrace=0' in the superuser context.\n");
+ #endif /* HAVE_LIBSELINUX */
++ if (err == EPERM)
++ fprintf(stderr,
++ "Could not attach to process. If your uid matches the uid of the target\n"
++ "process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try\n"
++ "again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf\n");
+ }
+
+ void
+@@ -73,8 +78,9 @@
+ {
+ debug(DEBUG_PROCESS, "trace_me: pid=%d", getpid());
+ if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {
++ int errno_save = errno;
+ perror("PTRACE_TRACEME");
+- trace_fail_warning(getpid());
++ trace_fail_warning(getpid(), errno_save);
+ exit(1);
+ }
+ }
+Index: ltrace-0.7.3/backend.h
+===================================================================
+--- ltrace-0.7.3.orig/backend.h 2014-05-07 15:03:16.000000000 -0400
++++ ltrace-0.7.3/backend.h 2014-05-07 15:25:00.805865317 -0400
+@@ -150,7 +150,7 @@
+
+ /* Called when trace_me or primary trace_pid fail. This may plug in
+ * any platform-specific knowledge of why it could be so. */
+-void trace_fail_warning(pid_t pid);
++void trace_fail_warning(pid_t pid, int err);
+
+ /* A pair of functions called to initiate a detachment request when
+ * ltrace is about to exit. Their job is to undo any effects that
+Index: ltrace-0.7.3/proc.c
+===================================================================
+--- ltrace-0.7.3.orig/proc.c 2014-05-07 15:03:16.000000000 -0400
++++ ltrace-0.7.3/proc.c 2014-05-07 15:24:42.881865595 -0400
+@@ -496,9 +496,10 @@
+
+ /* First, see if we can attach the requested PID itself. */
+ if (open_one_pid(pid)) {
++ int errno_save = errno;
+ fprintf(stderr, "Cannot attach to pid %u: %s\n",
+ pid, strerror(errno));
+- trace_fail_warning(pid);
++ trace_fail_warning(pid, errno_save);
+ return;
+ }
+
-
debian/patches/arm_backend_fixes_1383e5bd.patch
-
--- 0.7.3-6.1/debian/patches/on_install_breakpoint_56134ff5.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/on_install_breakpoint_56134ff5.patch 2016-04-07 21:58:05.000000000 +0000
@@ -0,0 +1,78 @@
+From 56134ff5442bee4e128b189bb86cfc97dcb6f60a Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Fri, 10 Jan 2014 20:05:15 +0100
+Subject: Add a new per-breakpoint callback on_install
+
+---
+ breakpoint.h | 9 ++++++++-
+ breakpoints.c | 11 ++++++++++-
+ 2 files changed, 18 insertions(+), 2 deletions(-)
+
+Index: b/breakpoint.h
+===================================================================
+--- a/breakpoint.h
++++ b/breakpoint.h
+@@ -1,6 +1,6 @@
+ /*
+ * This file is part of ltrace.
+- * Copyright (C) 2012 Petr Machata, Red Hat Inc.
++ * Copyright (C) 2012,2013,2014 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2009 Juan Cespedes
+ *
+ * This program is free software; you can redistribute it and/or
+@@ -48,6 +48,7 @@ struct breakpoint;
+ struct bp_callbacks {
+ void (*on_hit)(struct breakpoint *bp, struct Process *proc);
+ void (*on_continue)(struct breakpoint *bp, struct Process *proc);
++ void (*on_install)(struct breakpoint *bp, struct Process *proc);
+ void (*on_retract)(struct breakpoint *bp, struct Process *proc);
+ };
+
+@@ -67,6 +68,12 @@ void breakpoint_on_hit(struct breakpoint
+ * continue_after_breakpoint. */
+ void breakpoint_on_continue(struct breakpoint *bp, struct Process *proc);
+
++/* Call ON_INSTALL handler of BP, if any is set. This should be
++ * called after the breakpoint is enabled for the first time, not
++ * every time it's enabled (such as after stepping over a site of a
++ * temporarily disabled breakpoint). */
++void breakpoint_on_install(struct breakpoint *bp, struct Process *proc);
++
+ /* Call on-retract handler of BP, if any is set. This should be
+ * called before the breakpoints are destroyed. The reason for a
+ * separate interface is that breakpoint_destroy has to be callable
+Index: b/breakpoints.c
+===================================================================
+--- a/breakpoints.c
++++ b/breakpoints.c
+@@ -1,6 +1,6 @@
+ /*
+ * This file is part of ltrace.
+- * Copyright (C) 2006,2007,2011,2012 Petr Machata, Red Hat Inc.
++ * Copyright (C) 2006,2007,2011,2012,2013,2014 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2009 Juan Cespedes
+ * Copyright (C) 1998,2001,2002,2003,2007,2008,2009 Juan Cespedes
+ * Copyright (C) 2006 Ian Wienand
+@@ -78,6 +78,14 @@ breakpoint_on_continue(struct breakpoint
+ }
+
+ void
++breakpoint_on_install(struct breakpoint *bp, struct Process *proc)
++{
++ assert(bp != NULL);
++ if (bp->cbs != NULL && bp->cbs->on_install != NULL)
++ (bp->cbs->on_install)(bp, proc);
++}
++
++void
+ breakpoint_on_retract(struct breakpoint *bp, struct Process *proc)
+ {
+ assert(bp != NULL);
+@@ -181,6 +189,7 @@ breakpoint_turn_on(struct breakpoint *bp
+ if (bp->enabled == 1) {
+ assert(proc->pid != 0);
+ enable_breakpoint(proc, bp);
++ breakpoint_on_install(bp, proc);
+ }
+ return 0;
+ }
-
--- 0.7.3-6.1/debian/patches/arm_vfp_params_1c8596d4.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/arm_vfp_params_1c8596d4.patch 2016-04-11 18:35:44.000000000 +0000
@@ -0,0 +1,173 @@
+From 1c8596d41dde12f9af6a21035fac0c64f428ab76 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Wed, 6 Feb 2013 16:06:03 +0100
+Subject: Implement VFP parameter passing for ARM backend
+
+---
+ sysdeps/linux-gnu/arm/fetch.c | 106 +++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 94 insertions(+), 12 deletions(-)
+
+Index: b/sysdeps/linux-gnu/arm/fetch.c
+===================================================================
+--- a/sysdeps/linux-gnu/arm/fetch.c
++++ b/sysdeps/linux-gnu/arm/fetch.c
+@@ -223,8 +223,15 @@ arch_library_clone(struct library *retp,
+ retp->arch = lib->arch;
+ }
+
++enum {
++ /* How many (double) VFP registers the AAPCS uses for
++ * parameter passing. */
++ NUM_VFP_REGS = 8,
++};
++
+ struct fetch_context {
+ struct pt_regs regs;
++
+ struct {
+ union {
+ double d[32];
+@@ -232,6 +239,16 @@ struct fetch_context {
+ };
+ uint32_t fpscr;
+ } fpregs;
++
++ /* VFP register allocation. ALLOC.S tracks whether the
++ * corresponding FPREGS.S register is taken, ALLOC.D the same
++ * for FPREGS.D. We only track 8 (16) registers, because
++ * that's what the ABI uses for parameter passing. */
++ union {
++ int16_t d[NUM_VFP_REGS];
++ int8_t s[NUM_VFP_REGS * 2];
++ } alloc;
++
+ unsigned ncrn;
+ arch_addr_t sp;
+ arch_addr_t nsaa;
+@@ -253,6 +270,8 @@ fetch_register_banks(struct Process *pro
+ context->ncrn = 0;
+ context->nsaa = context->sp = get_stack_pointer(proc);
+
++ memset(&context->alloc, 0, sizeof(context->alloc));
++
+ return 0;
+ }
+
+@@ -301,6 +320,67 @@ arch_fetch_arg_clone(struct Process *pro
+ return clone;
+ }
+
++/* 0 is success, 1 is failure, negative value is an error. */
++static int
++pass_in_vfp(struct fetch_context *ctx, struct Process *proc,
++ enum arg_type type, size_t count, struct value *valuep)
++{
++ assert(type == ARGTYPE_FLOAT || type == ARGTYPE_DOUBLE);
++ unsigned max = type == ARGTYPE_DOUBLE ? NUM_VFP_REGS : 2 * NUM_VFP_REGS;
++ if (count > max)
++ return 1;
++
++ size_t i;
++ size_t j;
++ for (i = 0; i < max; ++i) {
++ for (j = i; j < i + count; ++j)
++ if ((type == ARGTYPE_DOUBLE && ctx->alloc.d[j] != 0)
++ || (type == ARGTYPE_FLOAT && ctx->alloc.s[j] != 0))
++ goto next;
++
++ /* Found COUNT consecutive unallocated registers at I. */
++ const size_t sz = (type == ARGTYPE_FLOAT ? 4 : 8) * count;
++ unsigned char *data = value_reserve(valuep, sz);
++ if (data == NULL)
++ return -1;
++
++ for (j = i; j < i + count; ++j)
++ if (type == ARGTYPE_DOUBLE)
++ ctx->alloc.d[j] = -1;
++ else
++ ctx->alloc.s[j] = -1;
++
++ if (type == ARGTYPE_DOUBLE)
++ memcpy(data, ctx->fpregs.d + i, sz);
++ else
++ memcpy(data, ctx->fpregs.s + i, sz);
++
++ return 0;
++
++ next:
++ continue;
++ }
++ return 1;
++}
++
++/* 0 is success, 1 is failure, negative value is an error. */
++static int
++consider_vfp(struct fetch_context *ctx, struct Process *proc,
++ struct arg_type_info *info, struct value *valuep)
++{
++ struct arg_type_info *float_info = NULL;
++ size_t hfa_size = 1;
++ if (info->type == ARGTYPE_FLOAT || info->type == ARGTYPE_DOUBLE)
++ float_info = info;
++ else
++ float_info = type_get_hfa_type(info, &hfa_size);
++
++ if (float_info != NULL && hfa_size <= 4)
++ return pass_in_vfp(ctx, proc, float_info->type,
++ hfa_size, valuep);
++ return 1;
++}
++
+ int
+ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
+ struct Process *proc,
+@@ -309,6 +389,12 @@ arch_fetch_arg_next(struct fetch_context
+ const size_t sz = type_sizeof(proc, info);
+ assert(sz != (size_t)-1);
+
++ if (ctx->hardfp) {
++ int rc;
++ if ((rc = consider_vfp(ctx, proc, info, valuep)) != 1)
++ return rc;
++ }
++
+ /* IHI0042E_aapcs: If the argument requires double-word
+ * alignment (8-byte), the NCRN is rounded up to the next even
+ * register number. */
+@@ -368,15 +454,14 @@ arch_fetch_retval(struct fetch_context *
+ size_t sz = type_sizeof(proc, info);
+ assert(sz != (size_t)-1);
+
++ if (ctx->hardfp) {
++ int rc;
++ if ((rc = consider_vfp(ctx, proc, info, valuep)) != 1)
++ return rc;
++ }
++
+ switch (info->type) {
+ unsigned char *data;
+- union {
+- struct {
+- uint32_t r0;
+- uint32_t r1;
+- } s;
+- unsigned char buf[8];
+- } u;
+
+ case ARGTYPE_VOID:
+ return 0;
+@@ -409,12 +494,9 @@ arch_fetch_retval(struct fetch_context *
+ case ARGTYPE_ULONG:
+ case ARGTYPE_POINTER:
+ pass_in_registers:
+- if (arm_get_register(proc, ARM_REG_R3, &u.s.r0) < 0
+- || (sz > 4 && arm_get_register(proc, ARM_REG_R1,
+- &u.s.r1) < 0)
+- || (data = value_reserve(valuep, sz)) == NULL)
++ if ((data = value_reserve(valuep, sz)) == NULL)
+ return -1;
+- memmove(data, u.buf, sz);
++ memmove(data, ctx->regs.uregs, sz);
+ return 0;
+ }
+ assert(info->type != info->type);
-
debian/patches/arm_attr_decoding_df7d2311.patch
-
--- 0.7.3-6.1/debian/patches/arm_plt_rel_9e33f5ac.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/arm_plt_rel_9e33f5ac.patch 2016-04-11 17:31:39.000000000 +0000
@@ -0,0 +1,65 @@
+From 9e33f5ac1037adeb32e9d693e6555967e9be68a6 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Mon, 4 Nov 2013 22:50:11 -0500
+Subject: Fix compilation on ARM
+
+- This was broken several commits back by removing pltrel from
+ struct ltelf.
+---
+ sysdeps/linux-gnu/arm/arch.h | 4 +++-
+ sysdeps/linux-gnu/arm/plt.c | 14 ++++++++++++++
+ 2 files changed, 17 insertions(+), 1 deletion(-)
+
+Index: b/sysdeps/linux-gnu/arm/arch.h
+===================================================================
+--- a/sysdeps/linux-gnu/arm/arch.h
++++ b/sysdeps/linux-gnu/arm/arch.h
+@@ -21,6 +21,8 @@
+ #ifndef LTRACE_ARM_ARCH_H
+ #define LTRACE_ARM_ARCH_H
+
++#include <libelf.h>
++
+ #define ARCH_HAVE_ENABLE_BREAKPOINT 1
+ #define ARCH_HAVE_DISABLE_BREAKPOINT 1
+
+@@ -43,7 +45,7 @@ struct arch_breakpoint_data {
+
+ #define ARCH_HAVE_LTELF_DATA
+ struct arch_ltelf_data {
+- /* We have this only for the hooks. */
++ Elf_Data *jmprel_data;
+ };
+
+ #define ARCH_HAVE_LIBRARY_DATA
+Index: b/sysdeps/linux-gnu/arm/plt.c
+===================================================================
+--- a/sysdeps/linux-gnu/arm/plt.c
++++ b/sysdeps/linux-gnu/arm/plt.c
+@@ -1,5 +1,6 @@
+ /*
+ * This file is part of ltrace.
++ * Copyright (C) 2013 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2010 Zach Welch, CodeSourcery
+ * Copyright (C) 2004,2008,2009 Juan Cespedes
+ *
+@@ -40,6 +41,19 @@ get_hardfp(uint64_t abi_vfp_args)
+ int
+ arch_elf_init(struct ltelf *lte, struct library *lib)
+ {
++ GElf_Addr jmprel_addr;
++ Elf_Scn *jmprel_sec;
++ GElf_Shdr jmprel_shdr;
++ if (elf_load_dynamic_entry(lte, DT_JMPREL, &jmprel_addr) < 0
++ || elf_get_section_covering(lte, jmprel_addr,
++ &jmprel_sec, &jmprel_shdr) < 0
++ || jmprel_sec == NULL)
++ return -1;
++
++ lte->arch.jmprel_data = elf_loaddata(jmprel_sec, &jmprel_shdr);
++ if (lte->arch.jmprel_data == NULL)
++ return -1;
++
+ /* Nothing in this section is strictly critical. It's not
+ * that much of a deal if we fail to guess right whether the
+ * ABI is softfp or hardfp. */
-
--- 0.7.3-6.1/debian/patches/Set-child-stack-alignment-in-trace-clone.c.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/Set-child-stack-alignment-in-trace-clone.c.patch 2016-04-07 16:28:21.000000000 +0000
@@ -0,0 +1,31 @@
+Author: Petr Machata <pmachata@apm-mustang-ev2-02.ml3.eng.bos.redhat.com>
+Description: Set child stack alignment in trace-clone.c
+ This is important on aarch64, which requires 16-byte aligned
+ stack pointer. This might be relevant on other arches as well,
+ I suspect we just happened to get the 16-byte boundary in some
+ cases.
+Applied-Upstream: http://anonscm.debian.org/gitweb/?p=collab-maint/ltrace.git;a=commit;h=0b5457a9e59978bcd2eb5240f54838910365a93c
+Last-Update: 2014-03-13
+
+Index: ltrace/testsuite/ltrace.minor/trace-clone.c
+===================================================================
+--- ltrace.orig/testsuite/ltrace.minor/trace-clone.c 2014-03-12 16:13:44.075726000 -0600
++++ ltrace/testsuite/ltrace.minor/trace-clone.c 2014-03-12 16:16:14.593150571 -0600
+@@ -8,6 +8,7 @@
+ #include <sys/types.h>
+ #include <stdlib.h>
+ #include <sched.h>
++#include <unistd.h>
+
+ int child ()
+ {
+@@ -22,7 +23,8 @@
+ int main ()
+ {
+ pid_t pid;
+- static char stack[STACK_SIZE];
++ static __attribute__ ((aligned (16))) char stack[STACK_SIZE];
++
+ #ifdef __ia64__
+ pid = __clone2((myfunc)&child, stack, STACK_SIZE, CLONE_FS, NULL);
+ #else
-
debian/patches/keep_plt_reloc_in_vector_673ff510.patch
-
--- 0.7.3-6.1/debian/patches/add_elf_read_next_u_439ab5bf.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0.7.3-6.1ubuntu2/debian/patches/add_elf_read_next_u_439ab5bf.patch 2016-04-08 02:27:27.000000000 +0000
@@ -0,0 +1,58 @@
+From 439ab5bfac8588e52c77e22c96fb397787512d0e Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata@redhat.com>
+Date: Tue, 5 Feb 2013 01:50:28 +0100
+Subject: Add elf_read_next_u*
+
+For stream-like reading of ELF data.
+---
+ ltrace-elf.c | 18 ++++++++++++++++++
+ ltrace-elf.h | 7 +++++++
+ 2 files changed, 25 insertions(+)
+
+Index: b/ltrace-elf.c
+===================================================================
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -242,6 +242,24 @@ DEF_READER(elf_read_u64, 64)
+
+ #undef DEF_READER
+
++#define DEF_READER(NAME, SIZE) \
++ int \
++ NAME(Elf_Data *data, GElf_Xword *offset, uint##SIZE##_t *retp) \
++ { \
++ int rc = elf_read_u##SIZE(data, *offset, retp); \
++ if (rc < 0) \
++ return rc; \
++ *offset += SIZE / 8; \
++ return 0; \
++ }
++
++DEF_READER(elf_read_next_u8, 8)
++DEF_READER(elf_read_next_u16, 16)
++DEF_READER(elf_read_next_u32, 32)
++DEF_READER(elf_read_next_u64, 64)
++
++#undef DEF_READER
++
+ int
+ ltelf_init(struct ltelf *lte, const char *filename)
+ {
+Index: b/ltrace-elf.h
+===================================================================
+--- a/ltrace-elf.h
++++ b/ltrace-elf.h
+@@ -109,6 +109,13 @@ int elf_read_u16(Elf_Data *data, GElf_Xw
+ int elf_read_u32(Elf_Data *data, GElf_Xword offset, uint32_t *retp);
+ int elf_read_u64(Elf_Data *data, GElf_Xword offset, uint64_t *retp);
+
++/* These are same as above, but update *OFFSET with the width
++ * of read datum. */
++int elf_read_next_u8(Elf_Data *data, GElf_Xword *offset, uint8_t *retp);
++int elf_read_next_u16(Elf_Data *data, GElf_Xword *offset, uint16_t *retp);
++int elf_read_next_u32(Elf_Data *data, GElf_Xword *offset, uint32_t *retp);
++int elf_read_next_u64(Elf_Data *data, GElf_Xword *offset, uint64_t *retp);
++
+ #if __WORDSIZE == 32
+ #define PRI_ELF_ADDR PRIx32
+ #define GELF_ADDR_CAST(x) (void *)(uint32_t)(x)
-
debian/patches/add_irelative_tracing_b420a226.patch