meson: Add -finstrument-functions to debug builds
diff mbox series

Message ID 20240912164909.2083093-1-paul.elder@ideasonboard.com
State New
Headers show
Series
  • meson: Add -finstrument-functions to debug builds
Related show

Commit Message

Paul Elder Sept. 12, 2024, 4:49 p.m. UTC
Add -finstrument-functions to debug (and debugoptimized) build types.
This will mainly be used for tracing functions with lttng by
LD_PRELOADing liblttng-ust-cyg-profile.so (or
liblttng-ust-cyg-profile-fast.so).

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Kieran Bingham Sept. 12, 2024, 4:58 p.m. UTC | #1
Quoting Paul Elder (2024-09-12 17:49:09)
> Add -finstrument-functions to debug (and debugoptimized) build types.
> This will mainly be used for tracing functions with lttng by
> LD_PRELOADing liblttng-ust-cyg-profile.so (or
> liblttng-ust-cyg-profile-fast.so).
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  meson.build | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 432ae1337..e8014e77f 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -109,6 +109,12 @@ common_arguments = [
>      '-include', meson.current_build_dir() / 'config.h',
>  ]
>  
> +if get_option('buildtype').startswith('debug')

Why is this added to debug builds rather than any build with 'tracing
enabled' ?

meson_options has:

option('tracing',
        type : 'feature',
        value : 'auto',
        description : 'Enable tracing (based on lttng)')

so this could be 'if get_option('tracing') ?


> +    common_arguments += [
> +        '-finstrument-functions',
> +    ]
> +endif
> +
>  c_arguments = []
>  cpp_arguments = []
>  
> -- 
> 2.39.2
>
Paul Elder Sept. 12, 2024, 11 p.m. UTC | #2
On Thu, Sep 12, 2024 at 05:58:54PM +0100, Kieran Bingham wrote:
> Quoting Paul Elder (2024-09-12 17:49:09)
> > Add -finstrument-functions to debug (and debugoptimized) build types.
> > This will mainly be used for tracing functions with lttng by
> > LD_PRELOADing liblttng-ust-cyg-profile.so (or
> > liblttng-ust-cyg-profile-fast.so).
> > 
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > ---
> >  meson.build | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/meson.build b/meson.build
> > index 432ae1337..e8014e77f 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -109,6 +109,12 @@ common_arguments = [
> >      '-include', meson.current_build_dir() / 'config.h',
> >  ]
> >  
> > +if get_option('buildtype').startswith('debug')
> 
> Why is this added to debug builds rather than any build with 'tracing
> enabled' ?

On one hand, good point.

On the other hand, the function tracing *should* work without tracing
enabled in libcamera. So technically they can be used separately. It's a
matter of if we think there's an actual purpose for enabling it.


Paul

> 
> meson_options has:
> 
> option('tracing',
>         type : 'feature',
>         value : 'auto',
>         description : 'Enable tracing (based on lttng)')
> 
> so this could be 'if get_option('tracing') ?
> 
> 
> > +    common_arguments += [
> > +        '-finstrument-functions',
> > +    ]
> > +endif
> > +
> >  c_arguments = []
> >  cpp_arguments = []
> >  
> > -- 
> > 2.39.2
> >
Laurent Pinchart Sept. 12, 2024, 11:07 p.m. UTC | #3
On Fri, Sep 13, 2024 at 01:00:35AM +0200, Paul Elder wrote:
> On Thu, Sep 12, 2024 at 05:58:54PM +0100, Kieran Bingham wrote:
> > Quoting Paul Elder (2024-09-12 17:49:09)
> > > Add -finstrument-functions to debug (and debugoptimized) build types.
> > > This will mainly be used for tracing functions with lttng by
> > > LD_PRELOADing liblttng-ust-cyg-profile.so (or
> > > liblttng-ust-cyg-profile-fast.so).
> > > 
> > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > > ---
> > >  meson.build | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 432ae1337..e8014e77f 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -109,6 +109,12 @@ common_arguments = [
> > >      '-include', meson.current_build_dir() / 'config.h',
> > >  ]
> > >  
> > > +if get_option('buildtype').startswith('debug')
> > 
> > Why is this added to debug builds rather than any build with 'tracing
> > enabled' ?
> 
> On one hand, good point.
> 
> On the other hand, the function tracing *should* work without tracing
> enabled in libcamera. So technically they can be used separately. It's a
> matter of if we think there's an actual purpose for enabling it.

Do you envision function tracing to be used in production, or should
debugging issues in production rely on trace points only ?

> > meson_options has:
> > 
> > option('tracing',
> >         type : 'feature',
> >         value : 'auto',
> >         description : 'Enable tracing (based on lttng)')
> > 
> > so this could be 'if get_option('tracing') ?
> > 
> > 
> > > +    common_arguments += [
> > > +        '-finstrument-functions',
> > > +    ]
> > > +endif
> > > +
> > >  c_arguments = []
> > >  cpp_arguments = []
> > >

Patch
diff mbox series

diff --git a/meson.build b/meson.build
index 432ae1337..e8014e77f 100644
--- a/meson.build
+++ b/meson.build
@@ -109,6 +109,12 @@  common_arguments = [
     '-include', meson.current_build_dir() / 'config.h',
 ]
 
+if get_option('buildtype').startswith('debug')
+    common_arguments += [
+        '-finstrument-functions',
+    ]
+endif
+
 c_arguments = []
 cpp_arguments = []