Re: GDB and Macros



mtm992003@xxxxxxxxx wrote:
I am currently debugging a program on Redhat AS 3.0 that has gdb
version 5.3.90-0.20030710.40rh that has functions as macros.  For
example:

#define PLENGTH ( X ) status.timeout = X

You realize, of course, that the syntax above means that `PLENGTH' will be replaced by `( X ) status.timeout = X'? (You need to lose the space between the macro name and its parameter list.)

However I can't get gdb to step into that function. Is there any way to do this?

Assuming that's a typo above, there's no function to step into. By the time the compiler `sees' code, macro substitution has already occurred.


I would recommend having a look at the output of `gcc -E <sourcefile name>' to see the results of preprocessing.

HTH,
--ag
--
Artie Gold -- Austin, Texas
http://goldsays.blogspot.com (new post 8/5)
http://www.cafepress.com/goldsays
"If you have nothing to hide, you're not trying!"
.



Relevant Pages

  • Re: Question about compilation/evaluation environments
    ... I guess it depends on what you mean by evaluating some code. ... In this case, the form is the macro function, aka macro ... invocation of compiled code produced by a compiler. ... ANY OF THESE FACILITIES MIGHT SHARE THE SAME EXECUTION ...
    (comp.lang.lisp)
  • Re: How to define a const and initialize it?
    ... > do the same work as const int MYCONST will do.... ... But the thing is that macro substitution takes ... C++ compiler isn't even aware of its existence. ... This Item might better be called "prefer the compiler to the preprocessor," because #define is often ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Preprocessor and sizeof()
    ... coming from a compiler vendor baffled me even more. ... "standard", i.e. poor) ... its headers and libraries, and in some cases is required to, as some ... into an issue with one such case, namely the offsetof macro. ...
    (comp.lang.c)
  • Re: Sacla loop: a new loop implementation
    ... the compiler is able to deduce enough about the type of thing ... That requires only that type information is *sometimes* ... > necessary information for the macro to expand. ... "statically typed language". ...
    (comp.lang.lisp)
  • Re: Dynamic unquote ( , )?
    ... Here X would simply be replaced by BAR by the compiler. ... X doesn't exist at the time the macro is called. ... But the macro expansion occurs inside X's environment, ... (defun foo (x) ...
    (comp.lang.lisp)