DBX print constants

G

GameboyHippo

I'm working with a library that contains many constants. These
constants are defined using the #define preprocessor directive. I'm
debugging a program. Is there a way to print out the value of the
constants? It would be much easier to print them out using DBX rather
than looking them up in various .h files.

For example, this is what I would like to do

(dbx) stop at fruit.cpp:34
(dbx) run
switch (fruit_type) {
(dbx) print fruit_type
fruit_type = 34
(dbx) print STRAWBERRY_TYPE
STRAWBERRY_TYPE = 42

Here's what really happens:
dbx: "STRAWBERRY_TYPE" is not defined in the scope
`fruit`fruit.cpp`main:34`

Now of course the names have all been changed to protect the innocent,
but the problem is that I don't want to dig through .h files and
documentation to find out what the various constants are equal to.
(And they may change from one version of the library to the next
anyway.)
 
A

Alf P. Steinbach

* GameboyHippo:
I'm working with a library that contains many constants. These
constants are defined using the #define preprocessor directive. I'm
debugging a program. Is there a way to print out the value of the
constants? It would be much easier to print them out using DBX rather
than looking them up in various .h files.

For example, this is what I would like to do

(dbx) stop at fruit.cpp:34
(dbx) run
switch (fruit_type) {
(dbx) print fruit_type
fruit_type = 34
(dbx) print STRAWBERRY_TYPE
STRAWBERRY_TYPE = 42

Here's what really happens:
dbx: "STRAWBERRY_TYPE" is not defined in the scope
`fruit`fruit.cpp`main:34`

Now of course the names have all been changed to protect the innocent,
but the problem is that I don't want to dig through .h files and
documentation to find out what the various constants are equal to.
(And they may change from one version of the library to the next
anyway.)

Use of a debugger is not related to the C++ /language/, and so you will
much better answers in a group dedicated to your tools.

The question is off-topic in [comp.lang.c++] (see the FAQ).

But in general, some debuggers can show symbolic information also for
macros, and whether that information is available depends on the build
settings.

Cheers, & hth.,

- Alf
 
G

GameboyHippo

* GameboyHippo:


I'm working with a library that contains many constants. These
constants are defined using the #define preprocessor directive. I'm
debugging a program. Is there a way to print out the value of the
constants? It would be much easier to print them out using DBX rather
than looking them up in various .h files.
For example, this is what I would like to do
(dbx) stop at fruit.cpp:34
(dbx) run
switch (fruit_type) {
(dbx) print fruit_type
fruit_type = 34
(dbx) print STRAWBERRY_TYPE
STRAWBERRY_TYPE = 42
Here's what really happens:
dbx: "STRAWBERRY_TYPE" is not defined in the scope
`fruit`fruit.cpp`main:34`
Now of course the names have all been changed to protect the innocent,
but the problem is that I don't want to dig through .h files and
documentation to find out what the various constants are equal to.
(And they may change from one version of the library to the next
anyway.)

Use of a debugger is not related to the C++ /language/, and so you will
much better answers in a group dedicated to your tools.

The question is off-topic in [comp.lang.c++] (see the FAQ).

But in general, some debuggers can show symbolic information also for
macros, and whether that information is available depends on the build
settings.

Cheers, & hth.,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Thanks, I'll post the question somewhere else.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top