diff mbox series

[oe,meta-oe,03/18] ltrace: Fix a NULL string use

Message ID 20181223213557.7834-3-raj.khem@gmail.com
State Accepted
Commit 79ab090e2f5b53ea317ed0038b4f408665f6908c
Headers show
Series [oe,meta-oe,01/18] modemmanager: Fix build with gcc9 | expand

Commit Message

Khem Raj Dec. 23, 2018, 9:35 p.m. UTC
This case is likely to happen when mod == NULL so print it when
we are computing modname and symname

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 ...o-same-block-where-modname-and-symna.patch | 37 +++++++++++++++++++
 meta-oe/recipes-devtools/ltrace/ltrace_git.bb |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ltrace/ltrace/0001-move-fprintf-into-same-block-where-modname-and-symna.patch

-- 
2.20.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/ltrace/ltrace/0001-move-fprintf-into-same-block-where-modname-and-symna.patch b/meta-oe/recipes-devtools/ltrace/ltrace/0001-move-fprintf-into-same-block-where-modname-and-symna.patch
new file mode 100644
index 0000000000..54acaace1a
--- /dev/null
+++ b/meta-oe/recipes-devtools/ltrace/ltrace/0001-move-fprintf-into-same-block-where-modname-and-symna.patch
@@ -0,0 +1,37 @@ 
+From 0cad025f80cf090dc16a5b70e21477f5b08a67fd Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 20 Dec 2018 11:27:45 -0800
+Subject: [PATCH] move fprintf into same block where modname and symname are
+ computed
+
+In its current state if mod turns out to be NULL then modname and
+symname will also turn out to be NULL and fprinting them as strings will
+be problematic
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ output.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/output.c b/output.c
+index b63befe..5aada7b 100644
+--- a/output.c
++++ b/output.c
+@@ -654,12 +654,11 @@ frame_callback (Dwfl_Frame *state, void *arg)
+ 					   NULL, NULL, NULL);
+ 		symname = dwfl_module_addrinfo(mod, pc, &off, &sym,
+ 					       NULL, NULL, NULL);
++		/* This mimics the output produced by libunwind below.  */
++		fprintf(options.output, " > %s(%s+0x%" PRIx64 ") [%" PRIx64 "]\n",
++			modname, symname, off, pc);
+ 	}
+ 
+-	/* This mimics the output produced by libunwind below.  */
+-	fprintf(options.output, " > %s(%s+0x%" PRIx64 ") [%" PRIx64 "]\n",
+-		modname, symname, off, pc);
+-
+ 	/* See if we can extract the source line too and print it on
+ 	   the next line if we can find it.  */
+ 	if (mod != NULL) {
diff --git a/meta-oe/recipes-devtools/ltrace/ltrace_git.bb b/meta-oe/recipes-devtools/ltrace/ltrace_git.bb
index f4033f7c27..83043cd212 100644
--- a/meta-oe/recipes-devtools/ltrace/ltrace_git.bb
+++ b/meta-oe/recipes-devtools/ltrace/ltrace_git.bb
@@ -25,6 +25,7 @@  SRC_URI = "git://github.com/sparkleholic/ltrace.git;branch=master;protocol=http
            file://0001-Add-support-for-mips64-n32-n64.patch \
            file://0001-configure-Recognise-linux-musl-as-a-host-OS.patch \
            file://0001-mips-plt.c-Delete-include-error.h.patch \
+           file://0001-move-fprintf-into-same-block-where-modname-and-symna.patch \
            "
 S = "${WORKDIR}/git"