Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | From 0cad025f80cf090dc16a5b70e21477f5b08a67fd Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 20 Dec 2018 11:27:45 -0800 |
| 4 | Subject: [PATCH] move fprintf into same block where modname and symname are |
| 5 | computed |
| 6 | |
| 7 | In its current state if mod turns out to be NULL then modname and |
| 8 | symname will also turn out to be NULL and fprinting them as strings will |
| 9 | be problematic |
| 10 | |
| 11 | Upstream-Status: Pending |
| 12 | |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
| 15 | output.c | 7 +++---- |
| 16 | 1 file changed, 3 insertions(+), 4 deletions(-) |
| 17 | |
| 18 | diff --git a/output.c b/output.c |
| 19 | index b63befe..5aada7b 100644 |
| 20 | --- a/output.c |
| 21 | +++ b/output.c |
| 22 | @@ -654,12 +654,11 @@ frame_callback (Dwfl_Frame *state, void *arg) |
| 23 | NULL, NULL, NULL); |
| 24 | symname = dwfl_module_addrinfo(mod, pc, &off, &sym, |
| 25 | NULL, NULL, NULL); |
| 26 | + /* This mimics the output produced by libunwind below. */ |
| 27 | + fprintf(options.output, " > %s(%s+0x%" PRIx64 ") [%" PRIx64 "]\n", |
| 28 | + modname, symname, off, pc); |
| 29 | } |
| 30 | |
| 31 | - /* This mimics the output produced by libunwind below. */ |
| 32 | - fprintf(options.output, " > %s(%s+0x%" PRIx64 ") [%" PRIx64 "]\n", |
| 33 | - modname, symname, off, pc); |
| 34 | - |
| 35 | /* See if we can extract the source line too and print it on |
| 36 | the next line if we can find it. */ |
| 37 | if (mod != NULL) { |