1999-04-16 03:35:26 +02:00
|
|
|
/* Support for complaint handling during symbol reading in GDB.
|
2002-09-19 02:42:41 +02:00
|
|
|
|
2020-01-01 07:20:01 +01:00
|
|
|
Copyright (C) 1990-2020 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-07-07 22:19:36 +02:00
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 20:08:50 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#include "defs.h"
|
2019-04-03 04:04:24 +02:00
|
|
|
#include "complaints.h"
|
2019-04-06 21:38:10 +02:00
|
|
|
#include "command.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
#include "gdbcmd.h"
|
2019-04-06 21:38:10 +02:00
|
|
|
#include <unordered_map>
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2018-05-17 07:22:54 +02:00
|
|
|
/* Map format strings to counters. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2018-05-17 07:22:54 +02:00
|
|
|
static std::unordered_map<const char *, int> counters;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2002-09-19 02:42:41 +02:00
|
|
|
/* How many complaints about a particular thing should be printed
|
|
|
|
before we stop whining about it? Default is no whining at all,
|
|
|
|
since so many systems have ill-constructed symbol files. */
|
|
|
|
|
2017-11-09 00:42:11 +01:00
|
|
|
int stop_whining = 0;
|
2002-09-19 02:42:41 +02:00
|
|
|
|
2018-05-17 07:10:51 +02:00
|
|
|
/* See complaints.h. */
|
2002-09-19 02:42:41 +02:00
|
|
|
|
2018-05-17 07:10:51 +02:00
|
|
|
void
|
|
|
|
complaint_internal (const char *fmt, ...)
|
2002-09-19 02:42:41 +02:00
|
|
|
{
|
2018-05-17 07:10:51 +02:00
|
|
|
va_list args;
|
2010-05-14 01:53:32 +02:00
|
|
|
|
2018-05-28 05:36:44 +02:00
|
|
|
if (++counters[fmt] > stop_whining)
|
2002-09-19 02:42:41 +02:00
|
|
|
return;
|
|
|
|
|
2018-05-17 07:10:51 +02:00
|
|
|
va_start (args, fmt);
|
2002-09-19 02:42:41 +02:00
|
|
|
|
2018-05-17 07:14:03 +02:00
|
|
|
if (deprecated_warning_hook)
|
2015-02-26 19:29:12 +01:00
|
|
|
(*deprecated_warning_hook) (fmt, args);
|
2002-09-19 02:42:41 +02:00
|
|
|
else
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
Simplify complaints even more
This removes the SHORT_FIRST_MESSAGE case from complaints, leaving
only a single case. This allows for the removal of the last argument
to clear_complaints, and also simplifies complaint_internal, removing
an extra allocation in the process.
After this, the "./gdb -iex 'set complaint 1' -nx ./gdb" example will
show:
Reading symbols from ./gdb...
During symbol reading: .debug_ranges entry has start address of zero [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: DW_AT_low_pc 0x0 is zero for DIE at 0x17116c1 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: .debug_line address at offset 0xa22f5 is 0 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: unsupported tag: 'DW_TAG_unspecified_type'
During symbol reading: const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0
This is a bit wordier but, I think, a bit more clear, as the form of
the message no longer depends on precisely when it was emitted. In
particular if you compare to the output from the 'Clean up "Reading
symbols" output' patch, you can see that earlier gdb would switch from
the prefix-less form to the "During symbol reading" form at a point
that is meaningless to the user (specifically, after psymtab reading
is done and gdb tries to expand a CU).
2018-10-04 Tom Tromey <tom@tromey.com>
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.
* complaints.h (clear_complaints): Remove argument.
* complaints.c (enum complaint_series): Remove.
(series): Remove global.
(complaint_internal): Update.
(clear_complaints): Remove argument.
gdb/testsuite/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* gdb.cp/maint.exp (test_invalid_name): Update expected output.
* gdb.gdb/complaints.exp (test_short_complaints): Remove.
(test_initial_complaints, test_empty_complaints): Update.
* gdb.dwarf2/dw2-stack-boundary.exp: Update.
2018-05-28 05:31:14 +02:00
|
|
|
fputs_filtered (_("During symbol reading: "), gdb_stderr);
|
|
|
|
vfprintf_filtered (gdb_stderr, fmt, args);
|
|
|
|
fputs_filtered ("\n", gdb_stderr);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2002-09-19 02:42:41 +02:00
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
Simplify complaints even more
This removes the SHORT_FIRST_MESSAGE case from complaints, leaving
only a single case. This allows for the removal of the last argument
to clear_complaints, and also simplifies complaint_internal, removing
an extra allocation in the process.
After this, the "./gdb -iex 'set complaint 1' -nx ./gdb" example will
show:
Reading symbols from ./gdb...
During symbol reading: .debug_ranges entry has start address of zero [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: DW_AT_low_pc 0x0 is zero for DIE at 0x17116c1 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: .debug_line address at offset 0xa22f5 is 0 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: unsupported tag: 'DW_TAG_unspecified_type'
During symbol reading: const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0
This is a bit wordier but, I think, a bit more clear, as the form of
the message no longer depends on precisely when it was emitted. In
particular if you compare to the output from the 'Clean up "Reading
symbols" output' patch, you can see that earlier gdb would switch from
the prefix-less form to the "During symbol reading" form at a point
that is meaningless to the user (specifically, after psymtab reading
is done and gdb tries to expand a CU).
2018-10-04 Tom Tromey <tom@tromey.com>
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.
* complaints.h (clear_complaints): Remove argument.
* complaints.c (enum complaint_series): Remove.
(series): Remove global.
(complaint_internal): Update.
(clear_complaints): Remove argument.
gdb/testsuite/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* gdb.cp/maint.exp (test_invalid_name): Update expected output.
* gdb.gdb/complaints.exp (test_short_complaints): Remove.
(test_initial_complaints, test_empty_complaints): Update.
* gdb.dwarf2/dw2-stack-boundary.exp: Update.
2018-05-28 05:31:14 +02:00
|
|
|
/* See complaints.h. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
void
|
Simplify complaints even more
This removes the SHORT_FIRST_MESSAGE case from complaints, leaving
only a single case. This allows for the removal of the last argument
to clear_complaints, and also simplifies complaint_internal, removing
an extra allocation in the process.
After this, the "./gdb -iex 'set complaint 1' -nx ./gdb" example will
show:
Reading symbols from ./gdb...
During symbol reading: .debug_ranges entry has start address of zero [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: DW_AT_low_pc 0x0 is zero for DIE at 0x17116c1 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: .debug_line address at offset 0xa22f5 is 0 [in module /home/tromey/gdb/build/gdb/gdb]
During symbol reading: unsupported tag: 'DW_TAG_unspecified_type'
During symbol reading: const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0
This is a bit wordier but, I think, a bit more clear, as the form of
the message no longer depends on precisely when it was emitted. In
particular if you compare to the output from the 'Clean up "Reading
symbols" output' patch, you can see that earlier gdb would switch from
the prefix-less form to the "During symbol reading" form at a point
that is meaningless to the user (specifically, after psymtab reading
is done and gdb tries to expand a CU).
2018-10-04 Tom Tromey <tom@tromey.com>
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(reread_symbols): Update.
* complaints.h (clear_complaints): Remove argument.
* complaints.c (enum complaint_series): Remove.
(series): Remove global.
(complaint_internal): Update.
(clear_complaints): Remove argument.
gdb/testsuite/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* gdb.cp/maint.exp (test_invalid_name): Update expected output.
* gdb.gdb/complaints.exp (test_short_complaints): Remove.
(test_initial_complaints, test_empty_complaints): Update.
* gdb.dwarf2/dw2-stack-boundary.exp: Update.
2018-05-28 05:31:14 +02:00
|
|
|
clear_complaints ()
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2018-05-17 07:22:54 +02:00
|
|
|
counters.clear ();
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
2005-02-10 18:32:53 +01:00
|
|
|
static void
|
2005-02-16 18:20:59 +01:00
|
|
|
complaints_show_value (struct ui_file *file, int from_tty,
|
|
|
|
struct cmd_list_element *cmd, const char *value)
|
2005-02-10 18:32:53 +01:00
|
|
|
{
|
|
|
|
fprintf_filtered (file, _("Max number of complaints about incorrect"
|
2005-02-16 18:20:59 +01:00
|
|
|
" symbols is %s.\n"),
|
2005-02-10 18:32:53 +01:00
|
|
|
value);
|
|
|
|
}
|
|
|
|
|
2020-01-13 20:01:38 +01:00
|
|
|
void _initialize_complaints ();
|
1999-04-16 03:35:26 +02:00
|
|
|
void
|
2020-01-13 20:01:38 +01:00
|
|
|
_initialize_complaints ()
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2010-12-31 23:59:52 +01:00
|
|
|
add_setshow_zinteger_cmd ("complaints", class_support,
|
|
|
|
&stop_whining, _("\
|
2005-01-29 Baurzhan Ismagulov <ibr@radix50.net>
* ax-gdb.c, ax-general.c, bcache.c, bfd-target.c, bsd-kvm.c,
* buildsym.c, c-lang.c, c-typeprint.c, c-valprint.c, charset.c,
* coff-pe-read.c, coffread.c, complaints.c, copying.c: I18n markup.
2005-01-29 18:53:26 +01:00
|
|
|
Set max number of complaints about incorrect symbols."), _("\
|
2005-02-10 18:32:53 +01:00
|
|
|
Show max number of complaints about incorrect symbols."), NULL,
|
2005-02-16 18:20:59 +01:00
|
|
|
NULL, complaints_show_value,
|
2004-07-28 21:42:01 +02:00
|
|
|
&setlist, &showlist);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|