Skip to content

Commit 2b107b2

Browse files
committed
Add option to display the source path along with the module label
Initial proposal in #267.
2 parents bf619ab + 4ad2fbd commit 2b107b2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.gdbinit

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,10 @@ class Source(Dashboard.Module):
11601160
self.offset = 0
11611161

11621162
def label(self):
1163-
return 'Source'
1163+
label = 'Source'
1164+
if self.show_path and self.file_name:
1165+
label += ': {}'.format(self.file_name)
1166+
return label
11641167

11651168
def lines(self, term_width, term_height, style_changed):
11661169
# skip if the current thread is not stopped
@@ -1170,6 +1173,7 @@ class Source(Dashboard.Module):
11701173
sal = gdb.selected_frame().find_sal()
11711174
current_line = sal.line
11721175
if current_line == 0:
1176+
self.file_name = None
11731177
return []
11741178
# try to lookup the source file
11751179
candidates = [
@@ -1286,6 +1290,12 @@ A value of 0 uses the whole height.''',
12861290
'type': int,
12871291
'check': check_gt_zero
12881292
},
1293+
'path': {
1294+
'doc': 'Path visibility flag in the module label.',
1295+
'default': False,
1296+
'name': 'show_path',
1297+
'type': bool
1298+
},
12891299
'highlight-line': {
12901300
'doc': 'Decide whether the whole current line should be highlighted.',
12911301
'default': False,

0 commit comments

Comments
 (0)