8sa1-binutils-gdb/gdb/tui
Tom de Vries d811a7cf74 [gdb/tui] Fix len_without_escapes in tui-disasm.c
On openSUSE Tumbleweed I run into:
...
FAIL: gdb.tui/basic.exp: asm window shows main
ERROR: invalid command name "_csi_L"
...

Using a minimal example, we get:
...
$ gdb -q outputs/gdb.tui/basic/basic -ex "tui enable" -ex "layout asm"
<TUI output>
src/gdb/ui-style.c:243: internal-error: bool \
  ui_file_style::parse(const char*, size_t*): Assertion `match == 0' failed.
...

The problem is in len_without_escapes, where we detect the start of an escape
sequence, but then pass ptr to style.parse while ptr no longer points to the
escape due to the ptr++ in the while condition:
...
  while ((c = *ptr++) != '\0')
     {
      if (c == '\033')
        {
          ui_file_style style;
          size_t n_read;
          if (style.parse (ptr, &n_read))
...

Fix this by removing the ++ in the while condition, and adding ptr++ in the
loop body where appropriate.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-04-06  Tom de Vries  <tdevries@suse.de>

	PR tui/27680
	* tui/tui-disasm.c (len_without_escapes): Pass ptr pointing at escape
	to style.parse.
2021-04-06 10:40:11 +02:00
..
ChangeLog-1998-2003 Eliminate the old mi/tui specific ChangeLog files as in ... 2004-01-12 15:16:44 +00:00
tui-command.c
tui-command.h
tui-data.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-data.h gdb: return true in TuiWindow.is_valid only if TUI is enabled 2021-02-08 11:56:16 +00:00
tui-disasm.c [gdb/tui] Fix len_without_escapes in tui-disasm.c 2021-04-06 10:40:11 +02:00
tui-disasm.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-file.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-file.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-hooks.c
tui-hooks.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-interp.c gdb/tui: fix issue with handling the return character 2021-02-08 09:51:46 +00:00
tui-io.c gdb/tui: fix issue with handling the return character 2021-02-08 09:51:46 +00:00
tui-io.h gdb/tui: fix issue with handling the return character 2021-02-08 09:51:46 +00:00
tui-layout.c gdb: return true in TuiWindow.is_valid only if TUI is enabled 2021-02-08 11:56:16 +00:00
tui-layout.h gdb/tui: don't add windows to global list from tui_layout🪟:apply 2021-02-08 11:18:33 +00:00
tui-location.c gdb/tui: remove special handling of locator/status window 2021-01-28 17:00:30 +00:00
tui-location.h gdb/tui: remove special handling of locator/status window 2021-01-28 17:00:30 +00:00
tui-out.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-out.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-regs.c Don't draw register sub windows outside the visible area 2021-02-07 19:13:45 +01:00
tui-regs.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-source.c gdb/tui: remove special handling of locator/status window 2021-01-28 17:00:30 +00:00
tui-source.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-stack.c gdb: move all "current target" wrapper implementations to target.c 2021-03-24 18:07:30 -04:00
tui-stack.h gdb/tui: remove special handling of locator/status window 2021-01-28 17:00:30 +00:00
tui-win.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-win.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-wingeneral.c gdb/tui: remove special handling of locator/status window 2021-01-28 17:00:30 +00:00
tui-wingeneral.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui-winsource.c gdb/tui: remove special handling of locator/status window 2021-01-28 17:00:30 +00:00
tui-winsource.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
tui.c gdb: return true in TuiWindow.is_valid only if TUI is enabled 2021-02-08 11:56:16 +00:00
tui.h gdb/tui: remove special handling of locator/status window 2021-01-28 17:00:30 +00:00