X-Git-Url: http://git.hcoop.net/bpt/guile.git/blobdiff_plain/ff1592a106f9a28dcbbd77939db0b2c1f9b27064..af082f9b1c7a8a2bafd5d95ce094c3aa9b5b7677:/gdbinit diff --git a/gdbinit b/gdbinit index 40c8f62bc..fdc9c759b 100644 --- a/gdbinit +++ b/gdbinit @@ -1,7 +1,16 @@ +# -*- GDB-Script -*- + +handle SIGPWR noprint nostop +handle SIGXCPU noprint nostop + define newline call (void)scm_newline (scm_current_error_port ()) end +define pp + call (void)scm_call_1 (scm_variable_ref (scm_c_module_lookup (scm_c_resolve_module ("ice-9 pretty-print"), "pretty-print")), $arg0) +end + define gdisplay call (void)scm_display ($arg0, scm_current_error_port ()) newline @@ -70,9 +79,11 @@ define smobdatatox smobwordtox $arg0 1 end -define program +define program_objcode smobdatatox $arg0 - p *(struct scm_program*)$x + set $objcode=$x + smobdatatox $objcode + p *(struct scm_objcode*)$x end define proglocals @@ -99,90 +110,95 @@ define smobdescriptor p scm_smobs[0xff & (((scm_t_bits)$arg0) >> 8)] end -define vmstack +define vmstackinit set $vmsp=sp set $vmstack_base=stack_base set $vmfp=fp set $vmbp=bp set $vmframe=0 - while $vmsp > vp->stack_base - set $orig_vmsp=$vmsp - while $vmsp > $vmstack_base - output $orig_vmsp - $vmsp - sputs "\t" - output $vmsp - sputs "\t" - gwrite *$vmsp - set $vmsp=$vmsp-1 - end - newline - sputs "Frame " - output $vmframe - newline - sputs "ra:\t" - output $vmsp - sputs "\t" - output (SCM*)*$vmsp - set $vmsp=$vmsp-1 - newline - sputs "mvra:\t" - output $vmsp - sputs "\t" - output (SCM*)*$vmsp - set $vmsp=$vmsp-1 - newline - sputs "dl:\t" - output $vmsp +end + +define nextframe + set $orig_vmsp=$vmsp + while $vmsp > $vmstack_base + output $orig_vmsp - $vmsp sputs "\t" - set $vmdl=(SCM*)(*$vmsp) - output $vmdl - newline - set $vmsp=$vmsp-1 - sputs "hl:\t" output $vmsp sputs "\t" gwrite *$vmsp set $vmsp=$vmsp-1 - sputs "el:\t" + end + newline + sputs "Frame " + output $vmframe + newline + sputs "ra:\t" + output $vmsp + sputs "\t" + output (SCM*)*$vmsp + set $vmsp=$vmsp-1 + newline + sputs "mvra:\t" + output $vmsp + sputs "\t" + output (SCM*)*$vmsp + set $vmsp=$vmsp-1 + newline + sputs "dl:\t" + output $vmsp + sputs "\t" + set $vmdl=(SCM*)(*$vmsp) + output $vmdl + newline + set $vmsp=$vmsp-1 + set $vmnlocs=(int)$vmbp->nlocs + while $vmnlocs > 0 + sputs "loc #" + output $vmnlocs + sputs ":\t" output $vmsp sputs "\t" gwrite *$vmsp set $vmsp=$vmsp-1 - set $vmnlocs=(int)$vmbp->nlocs - while $vmnlocs > 0 - sputs "loc #" - output $vmnlocs - sputs ":\t" - output $vmsp - sputs "\t" - gwrite *$vmsp - set $vmsp=$vmsp-1 - set $vmnlocs=$vmnlocs-1 - end - set $vmnargs=(int)$vmbp->nargs - while $vmnargs > 0 - sputs "arg #" - output $vmnargs - sputs ":\t" - output $vmsp - sputs "\t" - gwrite *$vmsp - set $vmsp=$vmsp-1 - set $vmnargs=$vmnargs-1 - end - sputs "prog:\t" + set $vmnlocs=$vmnlocs-1 + end + set $vmnargs=(int)$vmbp->nargs + while $vmnargs > 0 + sputs "arg #" + output $vmnargs + sputs ":\t" output $vmsp sputs "\t" gwrite *$vmsp set $vmsp=$vmsp-1 - newline - if !$vmdl - loop_break - end + set $vmnargs=$vmnargs-1 + end + sputs "prog:\t" + output $vmsp + sputs "\t" + gwrite *$vmsp + set $vmsp=$vmsp-1 + newline + if $vmdl set $vmfp=$vmdl - set $vmbp=(struct scm_program*)(((SCM*)($vmfp[-1]))[1]) + set $vmbp=(struct scm_objcode*)((SCM*)(((SCM*)($vmfp[-1]))[1])[1]) set $vmstack_base=$vmfp+$vmbp->nargs+$vmbp->nlocs+4 set $vmframe=$vmframe+1 newline end end + +define vmstack + vmstackinit + while $vmsp > vp->stack_base + nextframe + end +end + +define inst + p scm_instruction_table[$arg0] +end + +define gbt + call scm_display_backtrace (scm_make_stack(0x404,0x304), scm_current_error_port (), 0x704, 0x704, 0x704) +end