Re: Exposing line/file/function call stack for debugging

2008-01-16 Fir de Conversatie Charles E Campbell Jr

Matt Wozniski wrote:

On Jan 16, 2008 3:59 PM, Ben Schmidt wrote:
  

Charles E. Campbell, Jr. wrote:


I think it'd be a small thing -- but only Bram knows for sure.

I'd like Decho (from my debugging plugin) to be able to report what
line/file/function it was called from so I can relate Decho output to
where it was generated.  Something like the following would do the trick:
  

I personally would think that having a function that returns the call stack 
as a
list would be a better interface for this, but agree it could be handy info to
have for plugin writers and for debugging vimscript generally.

This should probably have been a new thread.

Ben.



function C()
  echo expand(sfile)
endfunction

function B()
  echo expand(sfile)
  call C()
endfunction

function A()
  echo expand(sfile)
  call B()
endfunction

call A()

results in this being printed:

function A
function A..B
function A..B..C

So, you can easily make a function yourself returning the callstack,
something like:

function! CallStack()
  return split(substitute(expand(sfile), '^\S\+\s', '', ''), '\.\.')
endfunction
  

If this is intended to address the topic for debugging ... just what 
line in the functions are A, B, and C called from?

Regards,
Chip Campbell


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Exposing line/file/function call stack for debugging

2008-01-16 Fir de Conversatie Ben Schmidt

 results in this being printed:
 
 function A
 function A..B
 function A..B..C
 
 So, you can easily make a function yourself returning the callstack,
 something like:
 
 function! CallStack()
   return split(substitute(expand(sfile), '^\S\+\s', '', ''), '\.\.')
 endfunction

That's cool; I didn't realise sfile behaved like that.

But what I was envisaging was something richer, i.e. with line numbers and 
source 
file as Chip had suggested.

Ben.




Send instant messages to your online friends http://au.messenger.yahoo.com 


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---