[RFA 0/9] Radically simplify the complaint system

Tom Tromey tom@tromey.com
Mon May 28 10:41:00 GMT 2018

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> What's happening here is that the SHORT_FIRST_MESSAGE stuff is printed
>> during the "Reading symbols...", and then once psymtabs are read, we hit
>> a call to clear_complaints.  Any subsequent complaints -- say, during
>> psymtab expansion -- are issued as ISOLATED_MESSAGE.

Pedro> Ah, OK.  I don't get those SHORT_FIRST_MESSAGE ones here, lucky me.


Pedro> I do get them if I interrupt debug info reading with ctrl-c, eh:

Now that is even more curious.  I can't interrupt debug info reading at
all.  And, this is what I'd expect, because the only QUIT in
dwarf2read.c is in dw_expand_symtabs_matching_file_matcher, which is
only used during CU expansion, not the initial read.

So I wonder why this works for you.

Pedro> I wonder whether printing the module name first, maybe also a context
Pedro> prefix, before the complaint message would make it a little bit nicer.
Pedro> Something like:

Pedro> Reading symbols from ./gdb...
Pedro> DWARF reader: /home/tromey/gdb/build/gdb/gdb: DW_AT_low_pc 0x0 is zero for DIE at 0x1717ad8
Pedro> DWARF reader: /home/tromey/gdb/build/gdb/gdb: debug_line address at offset 0xa6284 is 0

I looked at this a bit.  There are two issues.

One is that the generic reader code (or whatever asks for psymtab
expansion, etc) does not know the name of the symbol reader it is
calling.  So, there's no convenient way to print "DWARF" there.

Second, in some cases the relevant module name isn't what is generically
available.  Consider read_comp_unit_head, which does:

  const char *filename = get_section_file_name (section);
	  complaint (_("debug type entry at offset %s is duplicate to"
		       " the entry at offset %s, signature %s"),
		     sect_offset_str (sect_off), sect_offset_str (dup_sect_off),
		     hex_string (header.signature));

Here, the file name might be the dwz file, or maybe some dwo file (I
don't know), depending on where the section originated.

So, for the time being, I plan to just tidy up the output a bit without
changing it too much.  Maybe one idea would be to remove the
SHORT_FIRST_MESSAGE case from complaints.c and just have every message
start "During symbol reading".  This would at least be explicit.

I do think it would be worthwhile to go through all the DWARF complaints
and fix them up to include the relevant locating information.

For example, bad call:

	  complaint (_("location description stack underflow"));

This is bad since there's no convenient way to find the offending DIE.
In the past I've debugged gdb to find these.

Good call:

	  complaint (_("compilation unit with DW_AT_GNU_dwo_name"
		       " has children (offset %s) [in module %s]"),
		     sect_offset_str (this_cu->sect_off),
		     bfd_get_filename (abfd));

Though, it occurs to me that going through all of them to include this
info would tend to work against the idea of some more generic fix.


More information about the Gdb-patches mailing list