Insert debugging symbol using GIMPLE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I'd like to add a debug symbol to the currently compiled object. To find
the point of interest, I iterate using gsi_{start,next,end}. As I am not
sure how debug symbols are handled in GCC, I tried to add a simple label
before the statement roughly as follows:

	static unsigned label_count = 0;
	char name[32] = { 0 };
	sprintf(name, "test_label_%x", ++label_count);

	location_t loc = gimple_location(stmt);
	tree identifier = get_identifier(name);

	tree l = build_decl(loc, LABEL_DECL, identifier,
	  void_type_node);

	DECL_CONTEXT(l) = current_function_decl;
	DECL_MODE(l) = VOIDmode;
	FORCED_LABEL(l) = 1;
	DECL_ARTIFICIAL(l) = 0;

	SET_IDENTIFIER_LABEL_VALUE(identifier, l);

	gimple label;
	label = gimple_build_label(l);
	gsi_insert_before(&gsi_current, l, GSI_NEW_STMT);
	// gimplestmt stmt = gsi_stmt(gsi_current)

While the label is visible in the RTL output (-fdump-rtl-all,
test.cpp.123r.expand), it does not show up in the resulting binary. This
is not unexpected; however, I am unsure how to add a debugging symbol in
place of that label.

I'd appreciate if anyone could point me into the right direction.

Regards



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux