Andi Kleen wrote: > On Tue, 28 Oct 2003 14:47:34 -0800 > George Anzinger wrote: > > > >>I see that Andrew has not picked up my latest kgdb. In the latest version I >>have the dwarf2 stuff working in entry.S. Just ask, off list. > > > Do you use the .cfi* mnemonics in newer binutils? Without that it would get ugly. I use asm mnemonics .uleb*, .sleb*, .byte and .long. For operands I use the defines in dwarf2.h (after fixing them to work with asm). These are, for the most part DW_CFA_* and other DW_* things. I put this together to build macros (CCP) so that I can code things like: CFI_preamble(c1,_PC,1,1) CFA_define_reference(_ESP,OLDESP) CFA_define_offset(_EIP,EIP-OLDESP) CFA_define_offset(_EBX,EBX-OLDESP) CFA_define_offset(_ECX,ECX-OLDESP) CFA_define_offset(_EDX,EDX-OLDESP) CFA_define_offset(_ESI,ESI-OLDESP) CFA_define_offset(_EDI,EDI-OLDESP) CFA_define_offset(_EBP,EBP-OLDESP) CFA_define_offset(_EAX,EAX-OLDESP) CFA_define_offset(_EFLAGS,EFLAGS-OLDESP) CFI_postamble(c1) /* * This is VERY sloppy. At this point all we want to do is get * the frame right for back tracing. It will not be good if * you try to single step. We use already defined labels. * We want to cover all call outs. */ FDE_preamble(c1,f0,do_lcall,(lcall27 - do_lcall)) CFA_define_cfa_offset(OLDESP+8) FDE_postamble(f0) FDE_preamble(c1,f00,ret_from_fork,(ret_from_intr - ret_from_fork)) CFA_define_cfa_offset(OLDESP+4) FDE_postamble(f00) FDE_preamble(c1,f1,ret_from_intr,(divide_error - ret_from_intr)) FDE_postamble(f1) FDE_preamble(c1,f2,error_code,(coprocessor_error - error_code)) CFA_define_cfa_offset(OLDESP+8) FDE_postamble(f2) FDE_preamble(c1,f3,device_not_available_emulate,(debug - device_not_available_emulate)) CFA_define_cfa_offset(OLDESP+4) FDE_postamble(f3) FDE_preamble(c1,f4,nmi_stack_correct,(nmi_stack_fixup - nmi_stack_correct)) CFA_define_cfa_offset(OLDESP+8) FDE_postamble(f4) Which allows "bt" through entry.S code. I did not try to allow you to get the correct answer if you stop in the middle of the register save or restore code. I attached two files. The dwarf2.h file I got from the cvs tree a few months ago and mung up to work with either asm or C. The dwarf2-lang.h file is the one with the above macros. This is a work in progress. I am working on adding the stack operations so I can tell gdb when to tie off the stack at an interrupt (its from user land) and when it can continue on through the interrupt. This requires telling it to look at the stack and to come up with a different p-register. (It took a while, but I have found that when gdb finds a return address of zero, it assumes that is the bottom of the stack and stops the back trace.) Another trick I would like to try is to build a call frame for the out of line spinlock code. I think if I can tell gdb to fetch the address part of the jmp back to the inline code as the return address, it will unwind correctly. This, again, requires the stack ops... -- George Anzinger george@mvista.com High-res-timers: http://sourceforge.net/projects/high-res-timers/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml