diff options
| author | Khem Raj <raj.khem@gmail.com> | 2018-12-23 10:57:37 -0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2018-12-23 13:29:20 -0800 |
| commit | 3b59515c5a5e550d309f2f75ff25268289b9b914 (patch) | |
| tree | 7085494574ae5c960740dda9168b96c0eca9de42 /meta-python/recipes-devtools/python | |
| parent | 7227733cbf8792444fe21fac729ab7f7d86a7866 (diff) | |
| download | meta-openembedded-3b59515c5a5e550d309f2f75ff25268289b9b914.tar.gz | |
python-pyflame: Upgrade to 1.6.7
Disable build on ppc as well
Drop already upstreamed patches
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: Tim "moto-timo" Orling <TicoTimo@gmail.com>
Cc: Derek Straka <derek@asterius.io>
Diffstat (limited to 'meta-python/recipes-devtools/python')
5 files changed, 6 insertions, 210 deletions
diff --git a/meta-python/recipes-devtools/python/python-pyflame-1.6.6/0001-ptrace-Abstract-over-user_regs_struct-name-which-dif.patch b/meta-python/recipes-devtools/python/python-pyflame-1.6.6/0001-ptrace-Abstract-over-user_regs_struct-name-which-dif.patch deleted file mode 100644 index 09c4394c2a..0000000000 --- a/meta-python/recipes-devtools/python/python-pyflame-1.6.6/0001-ptrace-Abstract-over-user_regs_struct-name-which-dif.patch +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | From 2ef124e235a47dd4742813cf80e11a89cf4f02f8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrew Jeffery <andrew@aj.id.au> | ||
| 3 | Date: Thu, 3 May 2018 12:35:31 +0930 | ||
| 4 | Subject: [PATCH] ptrace: Abstract over user_regs_struct name, which differs on | ||
| 5 | ARM32 | ||
| 6 | |||
| 7 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | ||
| 8 | --- | ||
| 9 | src/ptrace.cc | 6 +++--- | ||
| 10 | src/ptrace.h | 10 ++++++++-- | ||
| 11 | 2 files changed, 11 insertions(+), 5 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/src/ptrace.cc b/src/ptrace.cc | ||
| 14 | index 485f58e4d82e..610fabb3b8e8 100644 | ||
| 15 | --- a/src/ptrace.cc | ||
| 16 | +++ b/src/ptrace.cc | ||
| 17 | @@ -122,8 +122,8 @@ void PtraceInterrupt(pid_t pid) { | ||
| 18 | DoWait(pid); | ||
| 19 | } | ||
| 20 | |||
| 21 | -struct user_regs_struct PtraceGetRegs(pid_t pid) { | ||
| 22 | - struct user_regs_struct regs; | ||
| 23 | +user_regs_struct PtraceGetRegs(pid_t pid) { | ||
| 24 | + user_regs_struct regs; | ||
| 25 | if (ptrace(PTRACE_GETREGS, pid, 0, ®s)) { | ||
| 26 | std::ostringstream ss; | ||
| 27 | ss << "Failed to PTRACE_GETREGS: " << strerror(errno); | ||
| 28 | @@ -132,7 +132,7 @@ struct user_regs_struct PtraceGetRegs(pid_t pid) { | ||
| 29 | return regs; | ||
| 30 | } | ||
| 31 | |||
| 32 | -void PtraceSetRegs(pid_t pid, struct user_regs_struct regs) { | ||
| 33 | +void PtraceSetRegs(pid_t pid, user_regs_struct regs) { | ||
| 34 | if (ptrace(PTRACE_SETREGS, pid, 0, ®s)) { | ||
| 35 | std::ostringstream ss; | ||
| 36 | ss << "Failed to PTRACE_SETREGS: " << strerror(errno); | ||
| 37 | diff --git a/src/ptrace.h b/src/ptrace.h | ||
| 38 | index 7083be1c4dfd..d6af8bf9f83a 100644 | ||
| 39 | --- a/src/ptrace.h | ||
| 40 | +++ b/src/ptrace.h | ||
| 41 | @@ -23,6 +23,12 @@ | ||
| 42 | |||
| 43 | #include "./config.h" | ||
| 44 | |||
| 45 | +#if defined(__arm__) | ||
| 46 | +typedef struct user_regs user_regs_struct; | ||
| 47 | +#else | ||
| 48 | +typedef struct user_regs_struct user_regs_struct; | ||
| 49 | +#endif | ||
| 50 | + | ||
| 51 | namespace pyflame { | ||
| 52 | |||
| 53 | int DoWait(pid_t pid, int options = 0); | ||
| 54 | @@ -39,10 +45,10 @@ void PtraceSeize(pid_t pid); | ||
| 55 | void PtraceInterrupt(pid_t pid); | ||
| 56 | |||
| 57 | // get regs from a process | ||
| 58 | -struct user_regs_struct PtraceGetRegs(pid_t pid); | ||
| 59 | +user_regs_struct PtraceGetRegs(pid_t pid); | ||
| 60 | |||
| 61 | // set regs in a process | ||
| 62 | -void PtraceSetRegs(pid_t pid, struct user_regs_struct regs); | ||
| 63 | +void PtraceSetRegs(pid_t pid, user_regs_struct regs); | ||
| 64 | |||
| 65 | // poke a long word into an address | ||
| 66 | void PtracePoke(pid_t pid, unsigned long addr, long data); | ||
| 67 | -- | ||
| 68 | 2.14.1 | ||
| 69 | |||
diff --git a/meta-python/recipes-devtools/python/python-pyflame-1.6.6/0001-symbol-Account-for-prelinked-shared-objects.patch b/meta-python/recipes-devtools/python/python-pyflame-1.6.6/0001-symbol-Account-for-prelinked-shared-objects.patch deleted file mode 100644 index 3eefc9cb98..0000000000 --- a/meta-python/recipes-devtools/python/python-pyflame-1.6.6/0001-symbol-Account-for-prelinked-shared-objects.patch +++ /dev/null | |||
| @@ -1,134 +0,0 @@ | |||
| 1 | From 007965d341349679607699d005c4af811b2c419a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrew Jeffery <andrew@aj.id.au> | ||
| 3 | Date: Fri, 4 May 2018 11:23:53 +0930 | ||
| 4 | Subject: [PATCH] symbol: Account for prelinked shared objects | ||
| 5 | |||
| 6 | Some projects, such as those derived from Yocto, tend to prelink their | ||
| 7 | binaries and libraries to reduce runtime overhead. Currently this trips | ||
| 8 | up pyflame in its symbol address calculations, and leads to ptrace | ||
| 9 | failures due to spurious addresses: | ||
| 10 | |||
| 11 | $ pyflame -t python -c "print 'foo'" | ||
| 12 | Unexpected ptrace(2) exception: Failed to PTRACE_PEEKDATA (pid 1482, addr 0x9f9b1d70): Input/output error | ||
| 13 | Unexpected ptrace(2) exception: Failed to PTRACE_PEEKDATA (pid 1482, addr 0x9f9b1d70): Input/output error | ||
| 14 | Unexpected ptrace(2) exception: Failed to PTRACE_PEEKDATA (pid 1482, addr 0x9f9b1d70): Input/output error | ||
| 15 | Unexpected ptrace(2) exception: Failed to PTRACE_PEEKDATA (pid 1482, addr 0x9f9b1d70): Input/output error | ||
| 16 | Unexpected ptrace(2) exception: Failed to PTRACE_PEEKDATA (pid 1482, addr 0x9f9b1d70): Input/output error | ||
| 17 | ... | ||
| 18 | |||
| 19 | Add support for reading a prelinked base p_vaddr out of the ELF and | ||
| 20 | adjust the PyAddresses values accordingly. | ||
| 21 | |||
| 22 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | ||
| 23 | --- | ||
| 24 | src/symbol.cc | 15 +++++++++++++++ | ||
| 25 | src/symbol.h | 29 ++++++++++++++++++++++++++++- | ||
| 26 | 2 files changed, 43 insertions(+), 1 deletion(-) | ||
| 27 | |||
| 28 | diff --git a/src/symbol.cc b/src/symbol.cc | ||
| 29 | index 125174efeeb5..39c3e8132dd1 100644 | ||
| 30 | --- a/src/symbol.cc | ||
| 31 | +++ b/src/symbol.cc | ||
| 32 | @@ -166,6 +166,17 @@ PyABI ELF::WalkTable(int sym, int str, PyAddresses *addrs) { | ||
| 33 | return abi; | ||
| 34 | } | ||
| 35 | |||
| 36 | +addr_t ELF::GetBaseAddress() { | ||
| 37 | + int32_t phnum = hdr()->e_phnum; | ||
| 38 | + int32_t i; | ||
| 39 | + for (i = 0; i < phnum && phdr(i)->p_type != PT_LOAD; i++) { | ||
| 40 | + } | ||
| 41 | + if (i == phnum) { | ||
| 42 | + throw FatalException("Failed to find PT_LOAD entry in program headers"); | ||
| 43 | + } | ||
| 44 | + return phdr(i)->p_vaddr; | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | PyAddresses ELF::GetAddresses(PyABI *abi) { | ||
| 48 | PyAddresses addrs; | ||
| 49 | PyABI detected_abi = WalkTable(dynsym_, dynstr_, &addrs); | ||
| 50 | @@ -176,6 +187,10 @@ PyAddresses ELF::GetAddresses(PyABI *abi) { | ||
| 51 | if (abi != nullptr) { | ||
| 52 | *abi = detected_abi; | ||
| 53 | } | ||
| 54 | + // Handle prelinked shared objects | ||
| 55 | + if (hdr()->e_type == ET_DYN) { | ||
| 56 | + return addrs - GetBaseAddress(); | ||
| 57 | + } | ||
| 58 | return addrs; | ||
| 59 | } | ||
| 60 | } // namespace pyflame | ||
| 61 | diff --git a/src/symbol.h b/src/symbol.h | ||
| 62 | index 124853bcc1c1..bb92b9a2604b 100644 | ||
| 63 | --- a/src/symbol.h | ||
| 64 | +++ b/src/symbol.h | ||
| 65 | @@ -28,15 +28,19 @@ | ||
| 66 | |||
| 67 | #if USE_ELF64 | ||
| 68 | #define ehdr_t Elf64_Ehdr | ||
| 69 | +#define phdr_t Elf64_Phdr | ||
| 70 | #define shdr_t Elf64_Shdr | ||
| 71 | #define dyn_t Elf64_Dyn | ||
| 72 | #define sym_t Elf64_Sym | ||
| 73 | +#define addr_t Elf64_Addr | ||
| 74 | #define ARCH_ELFCLASS ELFCLASS64 | ||
| 75 | #else | ||
| 76 | #define ehdr_t Elf32_Ehdr | ||
| 77 | +#define phdr_t Elf32_Phdr | ||
| 78 | #define shdr_t Elf32_Shdr | ||
| 79 | #define dyn_t Elf32_Dyn | ||
| 80 | #define sym_t Elf32_Sym | ||
| 81 | +#define addr_t Elf32_Addr | ||
| 82 | #define ARCH_ELFCLASS ELFCLASS32 | ||
| 83 | #endif | ||
| 84 | |||
| 85 | @@ -67,8 +71,18 @@ struct PyAddresses { | ||
| 86 | interp_head_hint(0), | ||
| 87 | pie(false) {} | ||
| 88 | |||
| 89 | + PyAddresses operator-(const unsigned long base) const { | ||
| 90 | + PyAddresses res(*this); | ||
| 91 | + res.tstate_addr = this->tstate_addr == 0 ? 0 : this->tstate_addr - base; | ||
| 92 | + res.interp_head_addr = | ||
| 93 | + this->interp_head_addr == 0 ? 0 : this->interp_head_addr - base; | ||
| 94 | + res.interp_head_fn_addr = | ||
| 95 | + this->interp_head_fn_addr == 0 ? 0 : this->interp_head_fn_addr - base; | ||
| 96 | + return res; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | PyAddresses operator+(const unsigned long base) const { | ||
| 100 | - PyAddresses res; | ||
| 101 | + PyAddresses res(*this); | ||
| 102 | res.tstate_addr = this->tstate_addr == 0 ? 0 : this->tstate_addr + base; | ||
| 103 | res.interp_head_addr = | ||
| 104 | this->interp_head_addr == 0 ? 0 : this->interp_head_addr + base; | ||
| 105 | @@ -113,6 +127,9 @@ class ELF { | ||
| 106 | // ABI. | ||
| 107 | PyAddresses GetAddresses(PyABI *abi); | ||
| 108 | |||
| 109 | + // Extract the base load address from the Program Header table | ||
| 110 | + addr_t GetBaseAddress(); | ||
| 111 | + | ||
| 112 | private: | ||
| 113 | void *addr_; | ||
| 114 | size_t length_; | ||
| 115 | @@ -122,6 +139,16 @@ class ELF { | ||
| 116 | return reinterpret_cast<const ehdr_t *>(addr_); | ||
| 117 | } | ||
| 118 | |||
| 119 | + inline const phdr_t *phdr(int idx) const { | ||
| 120 | + if (idx < 0) { | ||
| 121 | + std::ostringstream ss; | ||
| 122 | + ss << "Illegal phdr index: " << idx; | ||
| 123 | + throw FatalException(ss.str()); | ||
| 124 | + } | ||
| 125 | + return reinterpret_cast<const phdr_t *>(p() + hdr()->e_phoff + | ||
| 126 | + idx * hdr()->e_phentsize); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | inline const shdr_t *shdr(int idx) const { | ||
| 130 | if (idx < 0) { | ||
| 131 | std::ostringstream ss; | ||
| 132 | -- | ||
| 133 | 2.14.1 | ||
| 134 | |||
diff --git a/meta-python/recipes-devtools/python/python-pyflame.inc b/meta-python/recipes-devtools/python/python-pyflame.inc index 340aab74ef..b3b153c57b 100644 --- a/meta-python/recipes-devtools/python/python-pyflame.inc +++ b/meta-python/recipes-devtools/python/python-pyflame.inc | |||
| @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" | |||
| 5 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" | 5 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" |
| 6 | DEPENDS = "python" | 6 | DEPENDS = "python" |
| 7 | 7 | ||
| 8 | SRC_URI = "git://github.com/uber/pyflame.git;protocol=https" | 8 | SRC_URI = "git://github.com/uber/pyflame.git;protocol=https;nobranch=1" |
| 9 | S = "${WORKDIR}/git" | 9 | S = "${WORKDIR}/git" |
| 10 | 10 | ||
| 11 | inherit pkgconfig autotools | 11 | inherit pkgconfig autotools |
| @@ -13,3 +13,4 @@ inherit pkgconfig autotools | |||
| 13 | COMPATIBLE_HOST_libc-musl_class-target = "null" | 13 | COMPATIBLE_HOST_libc-musl_class-target = "null" |
| 14 | COMPATIBLE_HOST_mipsarch_class-target = "null" | 14 | COMPATIBLE_HOST_mipsarch_class-target = "null" |
| 15 | COMPATIBLE_HOST_aarch64_class-target = "null" | 15 | COMPATIBLE_HOST_aarch64_class-target = "null" |
| 16 | COMPATIBLE_HOST_powerpc_class-target = "null" | ||
diff --git a/meta-python/recipes-devtools/python/python-pyflame_1.6.6.bb b/meta-python/recipes-devtools/python/python-pyflame_1.6.6.bb deleted file mode 100644 index 8dedb89286..0000000000 --- a/meta-python/recipes-devtools/python/python-pyflame_1.6.6.bb +++ /dev/null | |||
| @@ -1,6 +0,0 @@ | |||
| 1 | require python-pyflame.inc | ||
| 2 | |||
| 3 | # v1.6.6 | ||
| 4 | SRCREV = "8a9d8c2acc3b3bb027475b738134f1e6fff14e6c" | ||
| 5 | SRC_URI += "file://0001-ptrace-Abstract-over-user_regs_struct-name-which-dif.patch" | ||
| 6 | SRC_URI += "file://0001-symbol-Account-for-prelinked-shared-objects.patch" | ||
diff --git a/meta-python/recipes-devtools/python/python-pyflame_1.6.7.bb b/meta-python/recipes-devtools/python/python-pyflame_1.6.7.bb new file mode 100644 index 0000000000..cb08f30a67 --- /dev/null +++ b/meta-python/recipes-devtools/python/python-pyflame_1.6.7.bb | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | require python-pyflame.inc | ||
| 2 | |||
| 3 | # v1.6.7 | ||
| 4 | SRCREV = "c151d2f34737f28a1f5266a003b2b0720bbd9f96" | ||
