Skip to content

Commit 56a1762

Browse files
committed
GDB logging parser (experimental)
The tmLanguages is now split into the base gdb syntax that handle all commands, number rendering, etc, applied on .gdb files A new parser made for gdb logging output, file ext being gdblog, gdb-log or gdb.log is now derived from the base allowing to overload the parser to tackle specific outputs like frame or backtrace Started from issue #41
1 parent 463c000 commit 56a1762

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

syntaxes/gdb-log.tmLanguage.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "gdb logging syntax",
4+
"scopeName": "source.gdb.log",
5+
"patterns": [
6+
{ "include": "#expression" },
7+
{ "include": "source.gdb" }
8+
],
9+
"repository": {
10+
"expression": {
11+
"patterns": [
12+
{ "include": "#prompt" },
13+
{ "include": "#frame" }
14+
]
15+
},
16+
"prompt": {
17+
"patterns": [
18+
{
19+
"name": "prompt.gdb",
20+
"begin": "^[ \t]*(\\(\\w+\\))[ \t]+",
21+
"beginCaptures": { "1": { "name": "support.class.prompt.gdb" } },
22+
"patterns": [ { "include": "source.gdb" } ],
23+
"end": "$"
24+
}
25+
]
26+
},
27+
"frame": {
28+
"patterns": [
29+
{
30+
"name": "frame.gdb",
31+
"match": "^[ \t]*(#\\d+)[ \t]+(0x[a-f0-9]+)[ \t]+(in)[ \t]+(\\w+)[ \t]*\\((.*)\\)[ \t]+(at|from)[ \t]+(.+)[ \t]*$",
32+
"captures": {
33+
"1": { "name": "entity.name.type.framenumber.gdb" },
34+
"2": { "patterns": [ { "include": "source.gdb#numeric" } ] },
35+
"3": { "name": "markup.bold.in.gdb" },
36+
"4": { "name": "support.function.gdb" },
37+
"5": { "patterns": [ { "include": "source.gdb"} ] },
38+
"6": { "name": "markup.bold.at.gdb" },
39+
"7": { "name": "markup.underline.link.filename.gdb" }
40+
}
41+
}
42+
]
43+
}
44+
}
45+
}

tests/logs/frame.gdb-log

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#0 0x0000007fb8d01338 in fdsan_error(char const*, ...) () from /apex/com.android.runtime/lib64/bionic/libc.so
2+
#1 0x0000007fb8d01048 in android_fdsan_close_with_tag () from /apex/com.android.runtime/lib64/bionic/libc.so
3+
#2 0x0000007fb8d017a4 in close () from /apex/com.android.runtime/lib64/bionic/libc.so
4+
#3 0x0000007fbe16a5a0 in open_next (f=0xb400007fb8876000) at ../../libcob/fileio.c:2232
5+
#4 0x0000007fbe16a984 in lineseq_read (f=0xb400007fb8876000, read_opts=1) at ../../libcob/fileio.c:2590
6+
#5 0x0000007fbe15f544 in cob_read_next (f=0xb400007fb8876000, fnstatus=0x5555564640 <prog_.f_26>, read_opts=1) at ../../libcob/fileio.c:6662
7+
#6 0x000000555555addc in prog_ (entry=0) at prog.c:368
8+
#7 0x000000555555a3ac in prog () at prog.c:51
9+
#8 0x000000555555a370 in main (argc=1, argv=0x7fffffe8c8) at prog.c:33

tests/logs/prompt.gdb-log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(gdb) p myvar

0 commit comments

Comments
 (0)