[Lldb-commits] [PATCH] D32421: Fix segfault resulting from empty print prompt

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 25 07:03:50 PDT 2017


labath added a comment.

Thanks for the patch Alex.

After looking around the code a bit (I'm quite new to that area as well), I think a better approach would be to fix MoveCursor to handle this situation gracefully. If you look at what this code does in the "normal" case, you'll see that it deletes the "n: " prompt on the last empty line. Your fix would bypass that and leave a dangling "1:" on the screen (which is not that bad really, but let's be consistent). If you look closely you'll see that the exact column we move the cursor to does not matter here (we immediately print \n), but we should still move the cursor one line up. Probably moving it to column 1 would be sufficient in this case.

You don't have worry about performance of this part of the code too much, as nothing it does will be slower than your hands. Readability is more important here.

A good way to "enhance" :) your learning experience would be to also create a test for this bug. I think that you will have to go for a pexpect-style test to reproduce this. TestConvenienceVariables.py would be a good candidate to model the test on. Let me know if you have any questions.

> I cannot reproduce it locally.

Well.. I guess that's how undefined behavior works in practice. :)


https://reviews.llvm.org/D32421





More information about the lldb-commits mailing list