albfan / vim-breakpts

Set/View Vim breakpoints and browse functions visually
24 stars 2 forks source link

Show a backtrace from debugging point #2

Closed albfan closed 9 years ago

albfan commented 10 years ago

This will be superuseful, but seems unworkable with actual implementation of vim, hope I'm wrong!

albfan commented 9 years ago

Using <sfile> may help

function! Foo() 
    echom expand("<sfile>") 
endfunction 

function! Bar() 
    call Foo() 
endfunction 

:call Bar() 
=> function Bar..Foo

that string must be decrypted for dict functions

albfan commented 9 years ago

autoload/breakpts.vim:L1330 shows that line is currently avaliable context.

The only problem is intermediate functions do not show it's current line. A workaround is parse that functions. In many cases there will be only one match for next function in bactrace.

Now #8 is implemented, adding a :BPDBacktrace command has no pitfalls to solve.

albfan commented 9 years ago

Set a breakpoint on a debugged debug session:

[DEBUG BREAKPTS]
Breakpoints:
1  func 201_ShowRemoteContext  línea 2 

and issue these evaluation

:2BPDEvaluate map(split(context,'\.\.'), 'split(v:val, ",.*".s:str_line." ")')
[["function tagbar#ToggleWindow"]
,
["200_ToggleWindow"]
,
["200_OpenWindow"]
,
["200_AutoUpdate"]
,
["200_RenderContent"]
,
["200_PrintKinds",
"5"]
]
  1. Just the part of complete line for intermediate functions is unimplemented.
  2. Define a new title "BreakPts_BackTrace" and copy/paste "BreakPts_Locals" open functionality

Anyone?

NOTE: New ToJson() function rocks! Don't it?

albfan commented 9 years ago

PR has been open on vim to provide lnum info

https://github.com/vim/vim/pull/426

More info on patch:

https://github.com/albfan/vim/issues/1

https://github.com/albfan/vim/commit/0566c3b9d4a19c6d712716d7e5dde1ac1a896ea7

albfan commented 9 years ago

Vim patch was accepted.

https://github.com/vim/vim/commit/1d6328ca00fc6cfe37b1f5e038ec23f443258886

Let's do some defensive code, to allow bactrace to work before and after that patch

if has("patch-7.4.879")
  "read line and number -> Foo[4]
else
  "just read line and last number