简体   繁体   English

emacs gud中的lldb不会更新“ up”的源文件

[英]lldb in emacs gud does not update source files for 'up'

I used https://opensource.apple.com/source/lldb/lldb-69/utils/emacs/gud.el and https://github.com/ptrv/emacs.d/blob/master/site-lisp/gud-lldb.el , and with emacs 24.3 and lldb in LLVM 3.9.1. 我使用了https://opensource.apple.com/source/lldb/lldb-69/utils/emacs/gud.elhttps://github.com/ptrv/emacs.d/blob/master/site-lisp/ gud-lldb.el ,以及LLVM 3.9.1中的emacs 24.3和lldb。 It can stop at breakpoint, and display the cursor at the correct source file in a separate emacs window. 它可以在断点处停止,并在单独的emacs窗口中将光标显示在正确的源文件上。 But 'up'/'down' command in lldb shows the new source code only in the lldb emacs window. 但是lldb中的“ up” /“ down”命令仅在lldb emacs窗口中显示新的源代码。 There is no a new emacs window showing the new source code. 没有新的emacs窗口显示新的源代码。

's'/'fin' can show the correct code in different windows. 's'/'fin'可以在不同的窗口中显示正确的代码。

Is this expected? 这是预期的吗?

I had better luck with https://github.com/ptrv/emacs.d/blob/master/site-lisp/gud-lldb.el in emacs 25.3.1. 我在emacs 25.3.1中使用https://github.com/ptrv/emacs.d/blob/master/site-lisp/gud-lldb.el更好了。 It also has the advantage that it doesn't try to patch gud.el. 它还具有不尝试修补gud.el的优点。 I is a more self contained solution. 我是一个更独立的解决方案。 It also failed to move the cursor when moving up and down the stack frames but with this change it works: 在上下移动堆栈帧时,它也无法移动光标,但是通过此更改它可以工作:

*** gud-lldb.el.orig    2017-12-11 17:22:08.000000000 -0700
--- gud-lldb.el 2017-11-18 11:52:55.000000000 -0700
***************
*** 64,73 ****
              ;; * thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread
              (string-match " at \\([^:\n]*\\):\\([0-9]*\\), stop reason = .*\n"
                            gud-marker-acc start)
!             ;; (lldb) frame select -r 1
!             ;; frame #1: 0x0000000100000e09 a.out`main + 25 at main.c:44
!             (string-match "^[ ]*frame.* at \\([^:\n]*\\):\\([0-9]*\\)\n"
!                            gud-marker-acc start))
        ;(message "gud-marker-acc matches our pattern....")
        (setq gud-last-frame
              (cons (match-string 1 gud-marker-acc)
--- 70,79 ----
                      ;; * thread #1: tid = 0x2e03, 0x0000000100000de8 a.out`c + 7 at main.c:39, stop reason = breakpoint 1.1, queue = com.apple.main-thread
              (string-match " at \\([^:\n]*\\):\\([0-9]*\\), stop reason = .*\n"
                            gud-marker-acc start)
!       ;; cherry
!       ;; (lldb) frame #1: 0x000000010013e29a sta`sta::PathEnumFaninVisitor::visitFromToPath(sta::Pin const*, sta::Vertex*, sta::TransRiseFall const*, sta::Tag*, sta::PathVertex*, sta::Edge*, sta::TimingArc*, float, sta::Vertex*, sta::TransRiseFall const*, sta::Tag*, float&, sta::MinMax const*, sta::PathAnalysisPt const*) + 986 at /Users/foobar/File.cc:348
!       (string-match "^.*frame.* at \\([^:\n]*\\):\\([0-9]*\\)\n"
!             gud-marker-acc start))
        ;(message "gud-marker-acc matches our pattern....")
        (setq gud-last-frame
              (cons (match-string 1 gud-marker-acc)

jjcherry56, your change works. jjcherry56,您的更改有效。 And, since you found it, I upvoted the previous answer to 0, from -1. 而且,由于您找到了它,因此我将先前的答案从-1提升为0。

So, I looked at that delta, and ended up making a small change explicitly. 因此,我查看了该增量,并最终进行了小幅更改。

In particular, I changed the part of the pattern: 特别是,我更改了模式的一部分:

string-match "^[ ]*frame

to

string-match "^.*frame

And it worked! 而且有效!

Admittedly, the "before" pattern (from jjcherry56's delta) in gud-lldb.el, ^[ ]*frame), was closer than ^frame (which was in the original modified gud.el, and which didn't work at all, and that file overwrote other language debuggers). 可以肯定的是,gud-lldb.el中的“之前”模式(来自jjcherry56的增量),^ [] * frame,比^ frame(在原始的修改过的gud.el中,但根本不起作用)更近。 ,并且该文件覆盖了其他语言的调试器)。

So, the modified pattern now takes anything from the beginning of the line to frame, rather than just zero or more blanks. 因此,修改后的模式现在从行的开始到帧都需要任何内容​​,而不仅仅是零或多个空白。 Much closer, if not, in fact, "there" (not even thinking about boundary conditions of multiple instance of "frame" on the line, and other deep testing :-). 实际上,如果不是,则更接近(如果没有)(甚至不考虑线路上“框架”的多个实例的边界条件,以及其他深度测试:-)。

jjcherry56, I suspect that someone's original downvote was because of the reference to the asker as "nube", and the absence of a specific summary of the explanation (it was certainly not me, and it was perhaps excessive, especially considering that your change has merit, but I can understand the reaction). jjcherry56,我怀疑某人最初的反对意见是因为将问询者称为“ nube”,并且缺少具体的解释摘要(当然不是我,而且可能太过分了,特别是考虑到您的更改已经优点,但我可以理解反应)。

The gud-lldb.el is definitely better for the reason(s) you stated, and your fix now allows me (and others (you too, Joe C)) to move forward in the quest to (continue to be able to) debug sanely using emacs/gud on the Mac. 由于您所述的原因,gud-lldb.el绝对更好,并且您的修复现在允许我(和其他人(您也是如此,Joe C))继续进行(继续进行)调试的任务在Mac上明智地使用emacs / gud。

PS I've tried everything to use gdb (I envy all those folks for whom it worked), no luck, so this is a saver. PS我已经尝试了一切使用gdb的方法(我很羡慕所有为它工作的人),没有运气,所以这很省钱。 Hey, I can actually set a breakpoint at depth, and Mx lldb stops there, and gives me the arrow in the buffer (which it will pop up)! 嘿,我实际上可以在深度处设置一个断点,然后Mx lldb停在那里,并向我提供缓冲区中的箭头(它将弹出)!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM