From 6ba185213659517b4299a3e4c92813839f19f045 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 14 Nov 2019 15:00:19 -0700 Subject: Handle %I64d in format_pieces We found a bug internally where gdb would crash while disassembling a certain instruction. This was tracked down to the handling of %I64d in format_pieces. format_pieces will convert %ll to %I64d on mingw -- so format_pieces should also handle parsing this format. In this patch, I've made the parsing unconditional, since I think it is harmless to accept extra formats. I've also taken the opportunity to convert the length modifier test to a "switch". Tested internally using our failing test case. gdb/ChangeLog 2019-11-21 Tom Tromey * gdbsupport/format.c (format_pieces): Parse %I64d. * unittests/format_pieces-selftests.c (test_windows_formats): New function. (run_tests): Call it. Change-Id: If335c7c2fc8d01e629cd55182394a483334d79c7 --- gdb/unittests/format_pieces-selftests.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gdb/unittests') diff --git a/gdb/unittests/format_pieces-selftests.c b/gdb/unittests/format_pieces-selftests.c index 3971201..d7e97d4 100644 --- a/gdb/unittests/format_pieces-selftests.c +++ b/gdb/unittests/format_pieces-selftests.c @@ -120,12 +120,23 @@ test_format_int_sizes () } static void +test_windows_formats () +{ + check ("rc%I64d", + { + format_piece ("rc", literal_piece, 0), + format_piece ("%I64d", long_long_arg, 0), + }); +} + +static void run_tests () { test_escape_sequences (); test_format_specifier (); test_gdb_formats (); test_format_int_sizes (); + test_windows_formats (); } } /* namespace format_pieces */ -- cgit v1.1