This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH v2 0/7] improve btrace enable error reporting


Hello Pedro,

Thanks for your comments.

> Great, thanks.  I'd think it a good idea to copy/paste that to the relevant patch's
> git log.


commit 41df50232209c74f3465556c9cfa690e16ee63ca
Author: Markus Metzger <markus.t.metzger@intel.com>
Date:   Fri Jan 19 09:41:42 2018 +0100

    btrace, gdbserver: use exceptions to convey btrace enable/disable errors
    
    Change error reporting to use exceptions and be prepared to catch them in
    gdbserver.  We use the exception message in our error reply to GDB.
    
    This may remove some detail from the error message in the native case since
    errno is no longer printed.  Later patches will improve that.
    
    We're still using error strings on the RSP level.  This patch does not affect
    the interoperability of older/newer GDB/gdbserver.


commit 54ab396195eee25b4045a2fc5226e73c508dc5a6
Author: Markus Metzger <markus.t.metzger@intel.com>
Date:   Fri Jan 19 14:32:09 2018 +0100

    btrace, gdbserver: remove the to_supports_btrace target method
    
    Remove the to_supports_btrace target method and instead rely on detecting errors
    when trying to enable recording.  This will also provide a suitable error
    message explaining why recording is not possible.
    
    For remote debugging, gdbserver will now always advertise branch tracing related
    packets.  When talking to an older GDB, this will cause GDB to try to enable
    branch tracing and gdbserver to report a suitable error message every time.
    
    An older gdbserver will not advertise branch tracing related packets if the
    one-time check failed, so a newer GDB with this patch will fail to enable branch
    tracing at remote_enable_btrace() rather than at btrace_enable().  The error
    message is the same in both cases so there should be no user-visible change.

 
> Off hand, I recall that in the no-expat cases, we say things like this:
> 
>       warning (_("Can not parse XML trace frame info; XML support "
>                  "was disabled at compile time"));
> 
>       warning (_("Can not parse XML memory map; XML support was disabled "
>                  "at compile time"));
> 
>       warning (_("Can not parse XML OS data; XML support was disabled "
>                 "at compile time"));
> 
> So maybe something around
> 
>   "Cannot do X; Intel PT support disabled at compile time."

X is always 'enable branch tracing' in our case.  But the reason for the error may
be different:
- libipt missing at build time
- kernel headers missing or too old at build time

Those reasons are not relevant for the user, though.  There are already config
warnings for those so if GDB is configured with --with-intel-pt=yes, the build
should fail with an appropriate diagnostic.  I'd omit it in the error message.

So you're suggesting to change

    "GDB does not support Intel Processor Trace."

into

    "Intel Processor Trace support was disabled at compile time."

Correct?

We're already using the above in a warning in remote.c.  I'd change that, as well,
to be consistent with the new wording.

OK?


> >> #3 - in patch 7:
> >>
> >> Instead of:
> >>
> >>   const char *filename = "/proc/sys/kernel/perf_event_paranoid";
> >>
> >> write:
> >>
> >>   static const char filename[] = ...;
> >
> > Regarding that last patch, it is checking a Debian-specific kernel
> > feature.  The upstream kernel only knows levels -1, 0, 1, and 2.  Even
> > setting the perf_event_paranoid level to 3 wouldn't cause any issues.
> >
> > What is our policy regarding this?  Do we accept such
> > distribution-specific checks into upstream GDB or do we expect the
> > Debian maintainers to maintain this patch on top of upstream GDB?
> 
> I don't think we have a written down policy.
> 
> I don't mind having it in master.  It helps users/developers running Debian and
> derivatives, and is not invasive.

The error message might be misleading on other systems but it is not very likely
that perf_event_paranoid is set to another value than those supported by that
system.

If upstream introduces a level 3, we may need to remove this diagnostic again.

So I'll leave the patch in and correct the declaration of FILENAME.  I found one
more occurrence in this series.

Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]