On Mon, Oct 07, 2019 at 01:26:24PM +0200, Jiri Olsa wrote:
> On Fri, Oct 04, 2019 at 10:39:52AM +0800, Changbin Du wrote:
> > When in TUI mode, it is impossible to show all the debug messages to
> > console. This make it hard to debug perf issues using debug messages.
> > This patch adds support for logging debug messages to file to resolve
> > this problem.
> > 
> > v3:
> >   o fix a segfault issue.
> 
> heya,
> getting segfault for this:
> 
> [jolsa@krava perf]$ ./perf report -vv 2>out
> Segmentation fault (core dumped)
>
This can be fixed by below change. In this case, log_file is NULL.

--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -37,8 +37,10 @@ int veprintf(int level, int var, const char *fmt, va_list 
args)
        if (var >= level) {
                if (use_browser >= 1 && !log_file)
                        ui_helpline__vshow(fmt, args);
-               else
+               else if (log_file)
                        ret = vfprintf(log_file, fmt, args);
+               else
+                       ret = vfprintf(stderr, fmt, args);
        }
 
        return ret;



> jirka
> 
> > v2:
> >   o specific all debug options one time.
> > 
> > Changbin Du (2):
> >   perf: support multiple debug options separated by ','
> >   perf: add support for logging debug messages to file
> > 
> >  tools/perf/Documentation/perf.txt |  15 ++--
> >  tools/perf/util/debug.c           | 124 +++++++++++++++++++-----------
> >  2 files changed, 90 insertions(+), 49 deletions(-)
> > 
> > -- 
> > 2.20.1
> > 

-- 
Cheers,
Changbin Du

Reply via email to