public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* debug_frame for optimized code
@ 2005-10-19 11:43 Christophe LYON
  2005-10-22  1:16 ` Jim Blandy
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe LYON @ 2005-10-19 11:43 UTC (permalink / raw)
  To: gdb


Hi all,

I know this is not a question directly related to GDB, but I don't know 
where else I could ask....

I am currently working on the debug_frame info emission in our C/C++
compiler (based on Open64).
I have recently come across optimized code which I don't know how to handle.

Consider the following function:

foo() {
	PROLOGUE

	if (COND1) {
		SAVE_REG r1 to stack
		compute
		bar1()
		RESTORE r1
	}
	else if (COND2) {
		bar2()
	}

	EPILOGUE
}

Suppose that the generated code looks like:
foo:
	PROLOGUE
	COND1
	if true goto LABEL1

	COND2
	if true goto LABEL2
	
epilogue_label:
	EPILOGUE

LABEL1:
	SAVE register r1 to stack
	compute....
	goto CALL_BAR1

LABEL2:
	CALL bar2
	goto epilogue_label

CALL_BAR1:
	CALL bar1
	RESTORE r1
	goto epilogue_label

So my question is:
what debug_frame info should I generate around LABEL1, LABEL2, and
CALL_BAR1 ?
Should I repeat all the info of the prologue before LABEL1 and LABEL2?
for CALL_BAR1, should I also add the save of register r1 ?

It's also unclear to me if I can/should use the
remember_state/restore_state dwarf operators.
Indeed, what is the rule?

Use remember_state after the prologue, and use restore state at LABEL1
and LABEL2?
But as states are defined as a stack, it means I would restore twice the
same thing...

Any help/suggestion highly appreciated!

Thanks,

Christophe.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: debug_frame for optimized code
  2005-10-19 11:43 debug_frame for optimized code Christophe LYON
@ 2005-10-22  1:16 ` Jim Blandy
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Blandy @ 2005-10-22  1:16 UTC (permalink / raw)
  To: Christophe LYON; +Cc: gdb


You should send questions like this to the dwarf-discuss mailing list:

http://mail.freestandards.org/cgi-bin/mailman/listinfo/dwarf-discuss

Christophe LYON <christophe.lyon@st.com> writes:
> Use remember_state after the prologue, and use restore state at LABEL1
> and LABEL2?
> But as states are defined as a stack, it means I would restore twice the
> same thing...

You could save after the prologue, then restore and immediately
re-save at LABEL1, and then restore at LABEL2.  But I'm not sure this
strategy generalizes too well.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-22  1:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-19 11:43 debug_frame for optimized code Christophe LYON
2005-10-22  1:16 ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).