Author Topic: How to debug macros  (Read 4753 times)

Offline mickagame

  • Single posting newcomer
  • *
  • Posts: 3
How to debug macros
« on: March 22, 2009, 11:20:10 am »
Does someone know how to set code::block to allow debug of macros?
I've tried to compile with -gdwarf-2 -g3 flags but no results ...

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: How to debug macros
« Reply #1 on: March 22, 2009, 01:46:41 pm »
Does someone know how to set code::block to allow debug of macros?
I've tried to compile with -gdwarf-2 -g3 flags but no results ...
What do you mean by "debug macros"? Could you give a simple example?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline mickagame

  • Single posting newcomer
  • *
  • Posts: 3
Re: How to debug macros
« Reply #2 on: March 22, 2009, 01:53:23 pm »
Have the possibility to do "step by step" in macros defined in .h files.
Actually when the current step in debugger is a macro when you do step by step the debugger doesn't go in the macro.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: How to debug macros
« Reply #3 on: March 22, 2009, 02:00:03 pm »
Really?
I don't think CB can do this :D
I haven't heard this function before.
Which IDE can do this? :shock:
« Last Edit: March 22, 2009, 02:08:12 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: How to debug macros
« Reply #4 on: March 22, 2009, 03:59:08 pm »
Macros are not compilable code, they are "generators". In other words, macros do not generate symbols or binary code at all, so there is no way you can step into them. What you can do, at most, is to preprocess a source file and see how macros were expanded... and that's it.

Offline mickagame

  • Single posting newcomer
  • *
  • Posts: 3
Re: How to debug macros
« Reply #5 on: March 22, 2009, 07:56:16 pm »
Before i was using dev cpp and i m sure i could do that !!!

Offline Seronis

  • Almost regular
  • **
  • Posts: 197
Re: How to debug macros
« Reply #6 on: March 22, 2009, 10:18:15 pm »
are your macros simple enough that you could use an inline function instead?  do that and you can step into it.