Skip to content

Commit bf619ab

Browse files
committed
Do not replace tabs in assembly output
Before this, the alignment was broken.
1 parent ae84052 commit bf619ab

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.gdbinit

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ See the `prompt` attribute. This value is used as a Python format string.''',
192192
class Beautifier():
193193

194194
def __init__(self, hint, tab_size=4):
195-
self.tab_spaces = ' ' * tab_size
195+
self.tab_spaces = ' ' * tab_size if tab_size else None
196196
self.active = False
197197
if not R.ansi or not R.syntax_highlighting:
198198
return
@@ -218,8 +218,9 @@ class Beautifier():
218218
pass
219219

220220
def process(self, source):
221-
# convert tabs anyway
222-
source = source.replace('\t', self.tab_spaces)
221+
# convert tabs if requested
222+
if self.tab_spaces:
223+
source = source.replace('\t', self.tab_spaces)
223224
if self.active:
224225
import pygments
225226
source = pygments.highlight(source, self.lexer, self.formatter)
@@ -1324,7 +1325,7 @@ The instructions constituting the current statement are marked, if available.'''
13241325
flavor = gdb.parameter('disassembly-flavor')
13251326
except:
13261327
flavor = 'att' # not always defined (see #36)
1327-
highlighter = Beautifier(flavor)
1328+
highlighter = Beautifier(flavor, tab_size=None)
13281329
# fetch the assembly code
13291330
line_info = None
13301331
frame = gdb.selected_frame() # PC is here

0 commit comments

Comments
 (0)