Skip to content

Commit 39dc85b

Browse files
committed
[breakpoints] move breakpoints into logfile_sub_source
1 parent a296e63 commit 39dc85b

47 files changed

Lines changed: 730 additions & 262 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NEWS.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,16 @@ Features:
9696
`:clear-breakpoints` commands have been added to
9797
support setting/clearing breakpoints for log messages.
9898
The `CTRL-B` shortcut toggles a breakpoint on the
99-
focused line in the LOG view. Also, if the log
100-
format specifies source file/line fields, the first
101-
character of the source file will be underlined and
102-
can be clicked to toggle a breakpoint. Once
103-
breakpoints have been added, you can press `F7`/`F8`
104-
to move to the previous/next log message that
105-
matches a breakpoint.
106-
- If the log format specifies source file/line fields,
107-
the first character of the source file will be
108-
underlined and can be clicked to open the source
109-
file at the given log message.
99+
focused line in the LOG view. Once breakpoints have
100+
been added, you can press `F7`/`F8` to move to the
101+
previous/next log message that matches a breakpoint.
102+
- If the log format specifies source file/line fields
103+
and a breakpoint is set, a red bullet point will be
104+
inserted to signify the presence of a breakpoint.
105+
In addition, if the `:add-source-path` command has
106+
been used, the first character of the source file
107+
will be underlined and can be clicked to open the
108+
source file at the given log message.
110109
* The `all_opids` and `all_thread_ids` virtual tables
111110
have been added to make it simple to discover all of
112111
the operations and threads across all log files. The

docs/schemas/config-v1.schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,16 @@
513513
"title": "/ui/theme-defs/<theme_name>/icons/log-level-fatal",
514514
"$ref": "#/definitions/icon"
515515
},
516+
"breakpoint": {
517+
"description": "Icon for a breakpoint marker",
518+
"title": "/ui/theme-defs/<theme_name>/icons/breakpoint",
519+
"$ref": "#/definitions/icon"
520+
},
521+
"disabled-breakpoint": {
522+
"description": "Icon for a disabled breakpoint marker",
523+
"title": "/ui/theme-defs/<theme_name>/icons/disabled-breakpoint",
524+
"$ref": "#/definitions/icon"
525+
},
516526
"play": {
517527
"description": "Icon for a 'play' button",
518528
"title": "/ui/theme-defs/<theme_name>/icons/play",

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ add_library(
535535
db_sub_source.cc
536536
dump_internals.cc
537537
elem_to_json.cc
538+
breakpoint_vtab.cc
538539
environ_vtab.cc
539540
ext.longpoll.cc
540541
extension-functions.cc

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ libdiag_a_SOURCES = \
617617

618618
PLUGIN_SRCS = \
619619
all_ids_vtabs.cc \
620+
breakpoint_vtab.cc \
620621
file_vtab.cc
621622

622623
if HAVE_WINDRES

src/all_ids_vtabs.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,5 +364,3 @@ auto all_vtabs_binder = injector::bind_multiple<vtab_module_base>()
364364
.add<vtab_module<tvt_no_update<all_thread_ids>>>();
365365

366366
} // namespace
367-
368-
DIST_SLICE(inject_bind) int lnav_all_ids = 3;

src/base/attr_line.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,19 @@ attr_line_t::append(ui_icon_t value)
285285
return *this;
286286
}
287287

288+
attr_line_t&
289+
attr_line_t::insert(size_t index, ui_icon_t value)
290+
{
291+
size_t start_len = this->al_string.length();
292+
293+
this->insert(index, " ");
294+
line_range lr{(int) index, (int) index + 2};
295+
296+
this->al_attrs.emplace_back(lr, VC_ICON.value(value));
297+
298+
return *this;
299+
}
300+
288301
namespace text_stream {
289302
struct word {
290303
string_fragment w_word;

src/base/attr_line.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ public:
294294

295295
attr_line_t& append(ui_icon_t value);
296296

297+
attr_line_t& insert(size_t index, ui_icon_t value);
298+
297299
template<typename S>
298300
attr_line_t& append(S str, const string_attr_pair& value)
299301
{

src/base/humanize.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ try_from(const string_fragment& sf)
6666
if (md[integer]) {
6767
auto scan_res = scn::scan_value<int64_t>(md[integer]->to_string_view());
6868

69+
if (!scan_res) {
70+
return std::nullopt;
71+
}
6972
return scan_res->value();
7073
}
7174

src/base/lnav.console.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,10 @@ wchar_for_icon(ui_icon_t ic)
517517
return {U'\U0001F132', role_t::VCR_ERROR};
518518
case ui_icon_t::log_level_fatal:
519519
return {U'\U0001F135', role_t::VCR_ERROR};
520-
520+
case ui_icon_t::breakpoint:
521+
return {U'\u25CF', role_t::VCR_ERROR};
522+
case ui_icon_t::disabled_breakpoint:
523+
return {U'\u25CB', role_t::VCR_WARNING};
521524
case ui_icon_t::play:
522525
return {U'\u25b6', role_t::VCR_TEXT};
523526
case ui_icon_t::edit:

src/base/string_attr_type.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ enum class ui_icon_t : int32_t {
6565
log_level_critical,
6666
log_level_fatal,
6767

68+
breakpoint,
69+
disabled_breakpoint,
70+
6871
play,
6972
edit,
7073
file,

0 commit comments

Comments
 (0)