This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

g++: __builtin_frame_address(0) behaviour


Hi,

For a lightweight argument tracing I've tried

template <ptrdiff_t x>
class diff_const{
	public:
	static void p(){
		cout << x << endl;
	}
};

void* f5_2(char* arg1,string& arg2,int arg3){
  diff_const<(char*)&arg1-(char*)__builtin_frame_address(0)> xj;
}

...but even though (&arg1-__builtin_frame_address(0)) should be a constant
expression on most platforms, gcc does not recognize it as such.

I need to store this as a stack/frame offset information for walking down
the call tree with full argument display in case of a function/method
failure. This would have zero overhead in the normal (successful) case.

Ideas, anyone?

-- 
---

Regards,

Stefan Schuerger


NEU : GMX Internet.FreeDSL
Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/dsl


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]