This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 0/9] Radically simplify the complaint system


On 05/28/2018 04:04 AM, Tom Tromey wrote:
>>>>>> "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.
> 
> Curious.
> 
> 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.


Yeah, turns out that the Ctrl-C remains pending until after
debug info reading:

$ ./gdb -q ./gdb
Reading symbols from ./gdb...^Cdone.   # a few seconds pass between ^C is printed and the "Quit".
Quit
Setting up the environment for debugging gdb.
unsupported tag: 'DW_TAG_unspecified_type'...debug info gives source 58 included from file at zero line 0...debug info gives command-line macro definition with non-zero line 19: _STDC_PREDEF_H 1...debug info gives command-line macro definition with non-zero line 38: __STDC_IEC_559__ 1...Breakpoint 1 at 0x638cb4: file /home/pedro/gdb/binutils-gdb-2/src/gdb/common/errors.c, line 54.
unsupported tag: 'DW_TAG_unspecified_type'...const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0...const value length mismatch for 'std::ratio<1, 1000000000>::den', got 8, expected 0...Member function "~_Sp_counted_base" (offset 0x42276f) is virtual but the vtable offset is not specified...cannot get low and high bounds for subprogram DIE at 0x42b720...cannot get low and high bounds for subprogram DIE at 0x42b7ce...Member function "~probe" (offset 0x43b527) is virtual but the vtable offset is not specified...Child DIE 0x443498 and its abstract origin 0x443434 have different parents...Child DIE 0x443598 and its abstract origin 0x443534 have different parents...Multiple children of DIE 0x445ca4 refer to DIE 0x445c93 as their abstract origin...Multiple children of DIE 0x44619d refer to DIE 0x44618c as their abstract origin...debug info gives source 156 included from file at zero line 0...Breakpoint 2 at 0x475caa: file /home/pedro/gdb/binutils-gdb-2/src/gdb/cli/cli-cmds.c, line 197.
(top-gdb) 

The quit comes from here:

(top-gdb) bt
#0  0x0000000000637a1f in throw_quit(char const*, ...) (fmt=0xc1b421 "Quit")
    at src/gdb/common/common-exceptions.c:403
#1  0x00000000008d0c96 in quit() () at src/gdb/utils.c:720
#2  0x0000000000709d2e in default_quit_handler() () at src/gdb/event-top.c:955
#3  0x00000000008d0cc6 in maybe_quit() () at src/gdb/utils.c:734
#4  0x000000000087829b in target_read(target_ops*, target_object, char const*, unsigned char*, unsigned long, long) (ops=0x1167ec0 <exec_ops>, object=TARGET_OBJECT_MEMORY, annex=0x0, buf=0x7fff81fbe620 "H\346\373\201\377\177", offset=10845696, len=1)
    at src/gdb/target.c:1543
#5  0x0000000000877cf7 in target_read_memory(unsigned long, unsigned char*, long) (memaddr=10845696, myaddr=0x7fff81fbe620 "H\346\373\201\377\177", len=1) at src/gdb/target.c:1335
#6  0x00000000005f2dc0 in program_breakpoint_here_p(gdbarch*, unsigned long) (gdbarch=0x1c83970, address=10845696)
    at src/gdb/breakpoint.c:8688
#7  0x00000000005f2ec4 in bp_loc_is_permanent(bp_location*) (loc=0x26310b0) at src/gdb/breakpoint.c:8712
#8  0x00000000005f2cf6 in add_location_to_breakpoint(breakpoint*, symtab_and_line const*) (b=0x1c3c220, sal=0x7fff81fbe780)
    at src/gdb/breakpoint.c:8656
#9  0x00000000005efd33 in init_raw_breakpoint(breakpoint*, gdbarch*, symtab_and_line, bptype, breakpoint_ops const*) (b=0x1c3c220, gdbarch=0x1c83970, sal=..., bptype=bp_std_terminate_master, ops=0x1168bc0 <internal_breakpoint_ops>)
    at src/gdb/breakpoint.c:7209
#10 0x00000000005efdf5 in set_raw_breakpoint(gdbarch*, symtab_and_line, bptype, breakpoint_ops const*) (gdbarch=0x1c83970, sal=..., bptype=bp_std_terminate_master, ops=0x1168bc0 <internal_breakpoint_ops>) at src/gdb/breakpoint.c:7243
#11 0x00000000005e7b27 in create_internal_breakpoint(gdbarch*, CORE_ADDR, bptype, breakpoint_ops const*) (gdbarch=0x1c83970, address=10845696, type=bp_std_terminate_master, ops=0x1168bc0 <internal_breakpoint_ops>) at src/gdb/breakpoint.c:3118
#12 0x00000000005e85a8 in create_std_terminate_master_breakpoint() () at src/gdb/breakpoint.c:3400
#13 0x00000000005fede1 in breakpoint_re_set() () at src/gdb/breakpoint.c:13907
#14 0x0000000000856dec in clear_symtab_users(enum_flags<symfile_add_flag>) (add_flags=...)
    at src/gdb/symfile.c:2774
#15 0x0000000000852911 in finish_new_objfile(objfile*, symfile_add_flags) (objfile=0x1c18d20, add_flags=...)
    at src/gdb/symfile.c:1028
#16 0x0000000000852d8f in symbol_file_add_with_addrs(bfd*, char const*, symfile_add_flags, section_addr_info*, objfile_flags, objfile*) (abfd=0x1473660, name=0x7fff81fc0c43 "./gdb", add_flags=..., addrs=0x0, flags=..., parent=0x0)
    at src/gdb/symfile.c:1162
#17 0x0000000000852ee7 in symbol_file_add_from_bfd(bfd*, char const*, enum_flags<symfile_add_flag>, std::vector<other_sections, std::allocator<other_sections> >*, enum_flags<objfile_flag>, objfile*) (abfd=0x1473660, name=0x7fff81fc0c43 "./gdb", add_flags=..., addrs=0x0, flags=..., parent=0x0) at src/gdb/symfile.c:1201
#18 0x0000000000852f41 in symbol_file_add(char const*, enum_flags<symfile_add_flag>, std::vector<other_sections, std::allocator<other_sections> >*, enum_flags<objfile_flag>) (name=0x7fff81fc0c43 "./gdb", add_flags=..., addrs=0x0, flags=...)
    at src/gdb/symfile.c:1214
#19 0x000000000085300f in symbol_file_add_main_1(char const*, symfile_add_flags, objfile_flags) (args=0x7fff81fc0c43 "./gdb", add_flags=..., flags=...) at src/gdb/symfile.c:1237
#20 0x0000000000852faa in symbol_file_add_main(char const*, enum_flags<symfile_add_flag>) (args=0x7fff81fc0c43 "./gdb", add_flags=...)
    at src/gdb/symfile.c:1228


And then when that happens, 'complaints.c'::series is not
restored back [because the clear_complaints call is skipped,
because it is not exception safe], so all the following
complaints are issued with SHORT_FIRST_MESSAGE:

 (top-gdb) p 'complaints.c'::series
 $2 = SHORT_FIRST_MESSAGE

> 
> 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.

Not sure what you mean here.  I was just thinking of something like
simply making sure to include "DWARF reader:" in all complaint calls in
dwarf2read.c.  Similarly in the other files/modules/readers.
Or instead, throughout the dwarf2read.c file use a 

 static void dwarf_complaint (const char *fmt, ...);

wrapper function that would include the prefix.

I guess I just see complaint output similar to "set debug foo" output,
where I also wish we were more consistent in printing some leading
prefix for each debug knob, like, "set debug infrun 1" producing
output messages prefixed with "infrun:" or something like that.

> 
> 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.

I'd think we could use those as module name.

> So, for the time being, I plan to just tidy up the output a bit without
> changing it too much.  

Yeah, just brainstorming.

> 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.

Right.

> 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.
I'm not sure I understand this last remark about a generic fix.

Thanks,
Pedro Alves

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]