This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Color the line marker
ClosedPublic

Authored by JDevlieghere on Feb 24 2020, 11:27 AM.

Details

Summary

Highlight the color marker similar to what we do for the column marker.

Diff Detail

Event Timeline

JDevlieghere created this revision.Feb 24 2020, 11:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2020, 11:27 AM
Herald added a subscriber: abidh. · View Herald Transcript

Simplify should_show_stop_line_with_ansi

clayborg requested changes to this revision.Feb 24 2020, 2:23 PM

If we are going to use this to to ansi stuff we should ensure the suffix works too. The current testing example will turn the line green along with all lines that follow if all other ansi stuff is removed. Right now I am guessing we are getting lucky because something else is doing the ansi reset. Once that is tested, this will be good to go.

lldb/test/Shell/Settings/TestLineMarkerColor.test
5

test suffix?

9

test suffix?

This revision now requires changes to proceed.Feb 24 2020, 2:23 PM
clayborg added inline comments.Feb 24 2020, 2:27 PM
lldb/source/Core/Debugger.cpp
365

do we have a setting to control how the current line marked? Right now do we hard code it to "->"?

When I stop I see:

(lldb) b main
Breakpoint 1: where = a.out`main + 20 at main.cpp:5:14, address = 0x0000000100000fa4
(lldb) r
Process 1635 launched: '/Users/gclayton/Documents/src/args/a.out' (x86_64)
Process 1635 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000fa4 a.out`main(argc=1, argv=0x00007ffeefbff7d0) at main.cpp:5:14
   2   	  return 2*i;
   3   	}
   4   	int main(int argc, const char **argv) {
-> 5   		int i = foo(argc);
   6   		return 0;
   7   	}
   8

Can we make this setting default to "-> " so that the user can change how the current line is marked above and beyond using a color or ansi code?

Explicitly check the suffix

JDevlieghere marked an inline comment as done.Feb 24 2020, 2:41 PM
JDevlieghere added inline comments.
lldb/source/Core/Debugger.cpp
365

It's probably doable but I'm not sure if it's worth it:

  • This is consistent with the column marker where it doesn't made sense to change the marker because it's just source code.
  • Either we need to enforce that the marker is <2 characters or we need to dynamically format everything based on the width, which is complicated by the escape codes.
  • You can't change the current PC marker either.
clayborg accepted this revision.Feb 24 2020, 3:32 PM

Ok, we can think about the PC marker later if it wouldn't just work in this setting.

This revision is now accepted and ready to land.Feb 24 2020, 3:32 PM

Ok, we can think about the PC marker later if it wouldn't just work in this setting.

Yeah, if we change either we should have them both behave the same way

This revision was automatically updated to reflect the committed changes.