[Bug c++/107513] [Feature Request] Implement __attribute__((__nodebug__))

2023-11-01 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107513

--- Comment #7 from Jonathan Wakely  ---
(In reply to Jonathan Wakely from comment #6)
> The patch for PR 96780 added -ffold-simple-inlines which works for some
> specific functions. This attribute would extend that to arbitrary functions.

I discussed this with Jason and Patrick, and the -ffold-simple-inlines effects
are not appropriate for implementing this attribute, because the attribute
might get used on functions which cannot be trivially folded by the front end.

It would need to be implemented differently, but probably wouldn't be
difficult.

[Bug c++/107513] [Feature Request] Implement __attribute__((__nodebug__))

2023-10-30 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107513

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed||2023-10-31
 Status|UNCONFIRMED |NEW
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=96780
 Ever confirmed|0   |1
   Severity|normal  |enhancement

--- Comment #6 from Jonathan Wakely  ---
The patch for PR 96780 added -ffold-simple-inlines which works for some
specific functions. This attribute would extend that to arbitrary functions.

Confirmed as a very useful extension.

[Bug c++/107513] [Feature Request] Implement __attribute__((__nodebug__))

2022-11-03 Thread roi.jacobson1 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107513

--- Comment #5 from Roy Jacobson  ---
I still think it might be good idea to introduce this for the sake of reducing
debug symbols size. I'm less interested in improving debug experience in this
case, but obviously any improvement to that is welcome as well.

[Bug c++/107513] [Feature Request] Implement __attribute__((__nodebug__))

2022-11-02 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107513

--- Comment #4 from Jonathan Wakely  ---
But what does DW_AT_artificial do? Does gdb just ignore it? I've never noticed
it helping at all.

[Bug c++/107513] [Feature Request] Implement __attribute__((__nodebug__))

2022-11-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107513

--- Comment #3 from Andrew Pinski  ---
(In reply to Roy Jacobson from comment #2)
> I might be using it wrong? But it doesn't seem to do anything:
> https://godbolt.org/z/9bdKhz4E7
> 
> It would be nice to at least avoid having the function's name in the binary,
> clang does it with nodebug.

because it does something different really.
It is not used to reduce debug info but rather to make the debugging experience
better.

It marks the inlined function with DW_AT_artificial.


.byte   0x1   # DW_AT_decl_file (/app/example.cpp)
.byte   0x2   # DW_AT_decl_line
.long   0x35  # DW_AT_type
.byte   0x3   # DW_AT_inline
.byte   0x1   # DW_AT_artificial

That is it is actually better than Clang's nodebug for debuggability reasons.

In my view nodebug is a hack rather than actually use DW_AT_artificial
correctly.

[Bug c++/107513] [Feature Request] Implement __attribute__((__nodebug__))

2022-11-02 Thread roi.jacobson1 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107513

--- Comment #2 from Roy Jacobson  ---
I might be using it wrong? But it doesn't seem to do anything:
https://godbolt.org/z/9bdKhz4E7

It would be nice to at least avoid having the function's name in the binary,
clang does it with nodebug.

[Bug c++/107513] [Feature Request] Implement __attribute__((__nodebug__))

2022-11-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107513

--- Comment #1 from Andrew Pinski  ---
GCC's artificial attribute should be similar for functions:
https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Common-Function-Attributes.html#index-artificial-function-attribute

Which was added in GCC 4.3.0 by r0-83503-gd752cfdb114944.

types GCC does not have one.

I suspect for your usage artificial is enough.