Dev C%2b%2b You Have Not Enabled Debugging Info

20.12.2020by
Dev C%2b%2b You Have Not Enabled Debugging Info Rating: 7,4/10 5209 reviews
Hi

2015-10-03 dev c无法编译调试(debug) 28 2016-07-12 初学C语言,用DEV-C,任何程序设置断点想调试时,都会. 6 2011-06-15 c语言按调试的按钮F10的时候会弹出一个对话框,内容是. Logged In: YES userid=1666392 Originator: NO. Yes that's true same message i also received while trying to debug my project, even after selecting yes in enable debbuging and rebuild project, i solve it in this way may be it will help you, goto menu project-project option, select tab compiler, select item linker in left panel and then finally select 'Generate debugging info to yes' in. For more information on debugging with VS Code, see this introduction to debugging in VS Code. For additional ways to configure the launch.json file so that you can debug your C/C app, see Configuring C/C debugging. Natvis framework. You create custom views of C object in the debugger with the Natvis framework. Mar 30, 2017 Learn how to debug your code using Dev C. Next, you'll create a launch.json file to configure VS Code to launch the Microsoft C debugger when you press F5 to debug the program. From the main menu, choose Run Add Configuration. And then choose C (Windows). You'll then see a dropdown for various predefined debugging configurations. Note: You can debug a simple application even if you don't have a folder open in VS Code, but it is not possible to manage launch configurations and set up advanced debugging. The VS Code Status Bar is purple if you do not have a folder open. Note that the attributes available in launch configurations vary from debugger to debugger.

I'm starting to play around with C++ and have Dev-C++ 4.9.9.2.
I have compiled the following and it works fine in the CMD screen:
I want to be able to step through the code, and watch the variables number1 and number2 but, when I add breakpoints, execute the code and then hover over the variables with the cursor, it reports 'number1 = Not found in current context' in the Debug window towards the left. Is this because the executable runs in the CMD screen?
Obviously, there's nothing wrong with this code, but I want to know how to Watch, Step, Set Breakpoints etc. for when I move onto more complicated code so I can TRUELY debug it. I've tried compiling it as a Project (it creates several files on my Desktop) and also as a simple test.exe from test.cpp that I created using Notepad but the result of my 'debugging' is the same.
What am I doing wrong?

Next: Optimize Options, Previous: Static Analyzer Options, Up: Invoking GCC [Contents][Index]

3.10 Options for Debugging Your Program

To tell GCC to emit extra information for use by a debugger, in almost all cases you need only to add -g to your other options.

GCC allows you to use -g with-O. The shortcuts taken by optimized code may occasionallybe surprising: some variables you declared may not existat all; flow of control may briefly move where you did not expect it;some statements may not be executed because they compute constantresults or their values are already at hand; some statements mayexecute in different places because they have been moved out of loops.Nevertheless it is possible to debug optimized output. This makesit reasonable to use the optimizer for programs that might have bugs.

If you are not using some other optimization option, considerusing -Og (see Optimize Options) with -g. With no -O option at all, some compiler passes that collectinformation useful for debugging do not run at all, so that-Og may result in a better debugging experience.

Dev C 2b 2b You Have Not Enabled Debugging Information

-g

Produce debugging information in the operating system’s native format(stabs, COFF, XCOFF, or DWARF). GDB can work with this debugginginformation.

On most systems that use stabs format, -g enables use of extradebugging information that only GDB can use; this extra informationmakes debugging work better in GDB but probably makes other debuggerscrash orrefuse to read the program. If you want to control for certain whetherto generate the extra information, use -gstabs+, -gstabs,-gxcoff+, -gxcoff, or -gvms (see below).

-ggdb

Produce debugging information for use by GDB. This means to use themost expressive format available (DWARF, stabs, or the native formatif neither of those are supported), including GDB extensions if at allpossible.

-gdwarf
-gdwarf-version

Produce debugging information in DWARF format (if that is supported).The value of version may be either 2, 3, 4 or 5; the default versionfor most targets is 4. DWARF Version 5 is only experimental.

Note that with DWARF Version 2, some ports require and alwaysuse some non-conflicting DWARF 3 extensions in the unwind tables.

Version 4 may require GDB 7.0 and -fvar-tracking-assignmentsfor maximum benefit.

GCC no longer supports DWARF Version 1, which is substantiallydifferent than Version 2 and later. For historical reasons, someother DWARF-related options such as-fno-dwarf2-cfi-asm) retain a reference to DWARF Version 2in their names, but apply to all currently-supported versions of DWARF.

-gstabs

Produce debugging information in stabs format (if that is supported),without GDB extensions. This is the format used by DBX on most BSDsystems. On MIPS, Alpha and System V Release 4 systems this optionproduces stabs debugging output that is not understood by DBX.On System V Release 4 systems this option requires the GNU assembler.

-gstabs+

Produce debugging information in stabs format (if that is supported),using GNU extensions understood only by the GNU debugger (GDB). Theuse of these extensions is likely to make other debuggers crash orrefuse to read the program.

-gxcoff

Produce debugging information in XCOFF format (if that is supported).This is the format used by the DBX debugger on IBM RS/6000 systems.

-gxcoff+

Produce debugging information in XCOFF format (if that is supported),using GNU extensions understood only by the GNU debugger (GDB). Theuse of these extensions is likely to make other debuggers crash orrefuse to read the program, and may cause assemblers other than the GNUassembler (GAS) to fail with an error.

-gvms

Produce debugging information in Alpha/VMS debug format (if that issupported). This is the format used by DEBUG on Alpha/VMS systems.

-glevel
-ggdblevel
-gstabslevel
-gxcofflevel
-gvmslevel

Request debugging information and also use level to specify howmuch information. The default level is 2.

Level 0 produces no debug information at all. Thus, -g0 negates-g.

Level 1 produces minimal information, enough for making backtraces inparts of the program that you don’t plan to debug. This includesdescriptions of functions and external variables, and line numbertables, but no information about local variables. /gedit-for-mac-os-mojave.html.

Level 3 includes extra information, such as all the macro definitionspresent in the program. Some debuggers support macro expansion whenyou use -g3.

If you use multiple -g options, with or without level numbers,the last such option is the one that is effective.

-gdwarf does not accept a concatenated debug level, to avoidconfusion with -gdwarf-level.Instead use an additional -glevel option to change thedebug level for DWARF.

-fno-eliminate-unused-debug-symbols

By default, no debug information is produced for symbols that are not actuallyused. Use this option if you want debug information for all symbols.

-femit-class-debug-always

Instead of emitting debugging information for a C++ class in only oneobject file, emit it in all object files using the class. This optionshould be used only with debuggers that are unable to handle the way GCCnormally emits debugging information for classes because using thisoption increases the size of debugging information by as much as afactor of two.

-fno-merge-debug-strings

Direct the linker to not merge together strings in the debugginginformation that are identical in different object files. Merging isnot supported by all assemblers or linkers. Merging decreases the sizeof the debug information in the output file at the cost of increasinglink processing time. Merging is enabled by default.

-fdebug-prefix-map=old=new

When compiling files residing in directory old, recorddebugging information describing them as if the files resided indirectory new instead. This can be used to replace abuild-time path with an install-time path in the debug info. It canalso be used to change an absolute path to a relative path by using. for new. This can give more reproducible builds, whichare location independent, but may require an extra command to tell GDBwhere to find the source files. See also -ffile-prefix-map.

-fvar-tracking

Run variable tracking pass. It computes where variables are stored at eachposition in code. Better debugging information is then generated(if the debugging information format supports this information).

It is enabled by default when compiling with optimization (-Os,-O, -O2, …), debugging information (-g) andthe debug info format supports it.

-fvar-tracking-assignments

Annotate assignments to user variables early in the compilation andattempt to carry the annotations over throughout the compilation all theway to the end, in an attempt to improve debug information whileoptimizing. Use of -gdwarf-4 is recommended along with it.

It can be enabled even if var-tracking is disabled, in which caseannotations are created and maintained, but discarded at the end.By default, this flag is enabled together with -fvar-tracking,except when selective scheduling is enabled.

-gsplit-dwarf

If DWARF debugging information is enabled, separate as much debugginginformation as possible into a separate output file with the extension.dwo. This option allows the build system to avoid linking files withdebug information. To be useful, this option requires a debugger capable ofreading .dwo files.

-gdwarf32
-gdwarf64

If DWARF debugging information is enabled, the -gdwarf32 selectsthe 32-bit DWARF format and the -gdwarf64 selects the 64-bitDWARF format. The default is target specific, on most targets it is-gdwarf32 though. The 32-bit DWARF format is smaller, butcan’t support more than 2GiB of debug information in any of the DWARFdebug information sections. The 64-bit DWARF format allows larger debuginformation and might not be well supported by all consumers yet.

-gdescribe-dies

Add description attributes to some DWARF DIEs that have no name attribute,such as artificial variables, external references and call siteparameter DIEs.

-gpubnames

Generate DWARF .debug_pubnames and .debug_pubtypes sections.

-ggnu-pubnames

Generate .debug_pubnames and .debug_pubtypes sections in a formatsuitable for conversion into a GDB index. This option is only usefulwith a linker that can produce GDB index version 7.

-fdebug-types-section

When using DWARF Version 4 or higher, type DIEs can be put intotheir own .debug_types section instead of making them part of the.debug_info section. It is more efficient to put them in a separatecomdat section since the linker can then remove duplicates.But not all DWARF consumers support .debug_types sections yetand on some objects .debug_types produces larger instead of smallerdebugging information.

-grecord-gcc-switches
-gno-record-gcc-switches

This switch causes the command-line options used to invoke thecompiler that may affect code generation to be appended to theDW_AT_producer attribute in DWARF debugging information. The optionsare concatenated with spaces separating them from each other and fromthe compiler version. It is enabled by default.See also -frecord-gcc-switches for anotherway of storing compiler options into the object file.

-gstrict-dwarf

Disallow using extensions of later DWARF standard version than selectedwith -gdwarf-version. On most targets using non-conflictingDWARF extensions from later standard versions is allowed.

-gno-strict-dwarf

Allow using extensions of later DWARF standard version than selected with-gdwarf-version.

-gas-loc-support

Inform the compiler that the assembler supports .loc directives.It may then use them for the assembler to generate DWARF2+ line numbertables.

This is generally desirable, because assembler-generated line-numbertables are a lot more compact than those the compiler can generateitself.

This option will be enabled by default if, at GCC configure time, theassembler was found to support such directives.

-gno-as-loc-support

Force GCC to generate DWARF2+ line number tables internally, if DWARF2+line number tables are to be generated.

-gas-locview-support

Inform the compiler that the assembler supports view assignmentand reset assertion checking in .loc directives.

This option will be enabled by default if, at GCC configure time, theassembler was found to support them.

-gno-as-locview-support

Force GCC to assign view numbers internally, if-gvariable-location-views are explicitly requested.

-gcolumn-info
-gno-column-info

Emit location column information into DWARF debugging information, ratherthan just file and line.This option is enabled by default.

-gstatement-frontiers
-gno-statement-frontiers

This option causes GCC to create markers in the internal representationat the beginning of statements, and to keep them roughly in placethroughout compilation, using them to guide the output of is_stmtmarkers in the line number table. This is enabled by default whencompiling with optimization (-Os, -O, -O2,…), and outputting DWARF 2 debug information at the normal level.

-gvariable-location-views
-gvariable-location-views=incompat5
-gno-variable-location-views

Augment variable location lists with progressive view numbers impliedfrom the line number table. This enables debug information consumers toinspect state at certain points of the program, even if no instructionsassociated with the corresponding source locations are present at thatpoint. If the assembler lacks support for view numbers in line numbertables, this will cause the compiler to emit the line number table,which generally makes them somewhat less compact. The augmented linenumber tables and location lists are fully backward-compatible, so theycan be consumed by debug information consumers that are not aware ofthese augmentations, but they won’t derive any benefit from them either.

This is enabled by default when outputting DWARF 2 debug information atthe normal level, as long as there is assembler support,-fvar-tracking-assignments is enabled and-gstrict-dwarf is not. When assembler support is notavailable, this may still be enabled, but it will force GCC to outputinternal line number tables, and if-ginternal-reset-location-views is not enabled, that will mostcertainly lead to silently mismatching location views.

There is a proposed representation for view numbers that is not backwardcompatible with the location list format introduced in DWARF 5, that canbe enabled with -gvariable-location-views=incompat5. Thisoption may be removed in the future, is only provided as a referenceimplementation of the proposed representation. Debug informationconsumers are not expected to support this extended format, and theywould be rendered unable to decode location lists using it.

-ginternal-reset-location-views
-gno-internal-reset-location-views

Attempt to determine location views that can be omitted from locationview lists. This requires the compiler to have very accurate insnlength estimates, which isn’t always the case, and it may causeincorrect view lists to be generated silently when using an assemblerthat does not support location view lists. The GNU assembler will flagany such error as a view number mismatch. This is only enabledon ports that define a reliable estimation function.

-ginline-points
-gno-inline-points

Generate extended debug information for inlined functions. Locationview tracking markers are inserted at inlined entry points, so thataddress and view numbers can be computed and output in debuginformation. This can be enabled independently of location views, inwhich case the view numbers won’t be output, but it can only be enabledalong with statement frontiers, and it is only enabled by default iflocation views are enabled.

-gz[=type]

Produce compressed debug sections in DWARF format, if that is supported.If type is not given, the default type depends on the capabilitiesof the assembler and linker used. type may be one of‘none’ (don’t compress debug sections), ‘zlib’ (use zlibcompression in ELF gABI format), or ‘zlib-gnu’ (use zlibcompression in traditional GNU format). If the linker doesn’t supportwriting compressed debug sections, the option is rejected. Otherwise,if the assembler does not support them, -gz is silently ignoredwhen producing object files.

-femit-struct-debug-baseonly

Emit debug information for struct-like typesonly when the base name of the compilation source filematches the base name of file in which the struct is defined.

This option substantially reduces the size of debugging information,but at significant potential loss in type information to the debugger.See -femit-struct-debug-reduced for a less aggressive option.See -femit-struct-debug-detailed for more detailed control.

This option works only with DWARF debug output.

-femit-struct-debug-reduced

Emit debug information for struct-like typesonly when the base name of the compilation source filematches the base name of file in which the type is defined,unless the struct is a template or defined in a system header.

This option significantly reduces the size of debugging information,with some potential loss in type information to the debugger.See -femit-struct-debug-baseonly for a more aggressive option.See -femit-struct-debug-detailed for more detailed control.

This option works only with DWARF debug output.

-femit-struct-debug-detailed[=spec-list]

Specify the struct-like typesfor which the compiler generates debug information.The intent is to reduce duplicate struct debug informationbetween different object files within the same program.

This option is a detailed version of-femit-struct-debug-reduced and -femit-struct-debug-baseonly,which serves for most needs.

A specification has the syntax
[‘dir:’ ‘ind:’][‘ord:’ ‘gen:’](‘any’ ‘sys’ ‘base’ ‘none’)

The optional first word limits the specification tostructs that are used directly (‘dir:’) or used indirectly (‘ind:’).A struct type is used directly when it is the type of a variable, member.Indirect uses arise through pointers to structs.That is, when use of an incomplete struct is valid, the use is indirect.An example is‘struct one direct; struct two * indirect;’.

The optional second word limits the specification toordinary structs (‘ord:’) or generic structs (‘gen:’).Generic structs are a bit complicated to explain.For C++, these are non-explicit specializations of template classes,or non-template classes within the above.Other programming languages have generics,but -femit-struct-debug-detailed does not yet implement them.

The third word specifies the source files for thosestructs for which the compiler should emit debug information.The values ‘none’ and ‘any’ have the normal meaning.The value ‘base’ means thatthe base of name of the file in which the type declaration appearsmust match the base of the name of the main compilation file.In practice, this means that when compiling foo.c, debug informationis generated for types declared in that file and foo.h,but not other header files.The value ‘sys’ means those types satisfying ‘base’or declared in system or compiler headers.

You may need to experiment to determine the best settings for your application.

The default is -femit-struct-debug-detailed=all.

This option works only with DWARF debug output.

Dev C 2b 2b You Have Not Enabled Debugging Inform

-fno-dwarf2-cfi-asm

Emit DWARF unwind info as compiler generated .eh_frame sectioninstead of using GAS .cfi_* directives.

Dev C 2b 2b You Have Not Enabled Debugging Informally

-fno-eliminate-unused-debug-types

Dev C 2b 2b You Have Not Enabled Debugging Informational

Normally, when producing DWARF output, GCC avoids producing debug symbol output for types that are nowhere used in the source file being compiled.Sometimes it is useful to have GCC emit debugginginformation for all types declared in a compilationunit, regardless of whether or not they are actually usedin that compilation unit, for example if, in the debugger, you want to cast a value to a type that isnot actually used in your program (but is declared). More often,however, this results in a significant amount of wasted space.

Next: Optimize Options, Previous: Static Analyzer Options, Up: Invoking GCC [Contents][Index]

Comments are closed.