This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: Alternative to __FILE__/__LINE__


    Yes, backtrace would be even better as long as I can check if I have it. I'll look for it.

    A __FILE__/__LINE__ alternative would be simpler but I fear that at least __LINE__ would be difficult and/or expensive to get and without it something like a __USR_FILE__ macro would be less interesting.

Thanks for your feedback

On 04/03/2018 22:30, Petr Ovtchenkov wrote:
On Sun, 4 Mar 2018 21:55:06 +0100 (CET)
Marc Glisse <marc.glisse@inria.fr> wrote:

On Sun, 4 Mar 2018, François Dumont wrote:

     Debug mode is using __FILE__/__LINE__ to show where the assertion took
place. So assertion looks like this:

/home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/deque:175:
Error: function requires a valid iterator range [__first, __last).

     But IMHO a smarter information would be to provide the file:line in the
source code that generated this assertion so that users could more easily go
to the faulty code.
How about printing a backtrace then? Though at some point the user might
want to start a debugger to get more information.

Backtrace will require BFD. BFD may be unavailable or unwanted.

--

   - ptr



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