public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Simon Marchi <simark@simark.ca>,
	gdb-patches@sourceware.org, Tom Tromey <tom@tromey.com>
Subject: Re: [RFAv4] Show locno for 'multi location' breakpoint hit msg+conv var $_hit_bbnum $_hit_locno.
Date: Sun, 20 Nov 2022 11:54:44 +0100	[thread overview]
Message-ID: <75718637483e4eb742006ebc514dd51607070326.camel@skynet.be> (raw)
In-Reply-To: <26ab916ba5ec80bc34bb44e96b4a90dd9ce801c6.camel@skynet.be>

On Sun, 2022-11-20 at 09:35 +0100, Philippe Waroquiers via Gdb-patches wrote:
> On Sat, 2022-11-19 at 21:06 -0500, Simon Marchi wrote:
> > 
> > Here are the other failures I get.  I didn't check if they were caused
> > by your patch, but since they appeared at the same time, it's likely.
> > 
> >  - gdb.threads/multi-create-ns-info-thr.exp
> >  - gdb.base/dprintf-execution-x-script.exp
> >  - gdb.base/commands.exp
> >  - gdb.base/bp-cmds-execution-x-script.exp
> >  - gdb.base/bp-cmds-continue-ctrl-c.exp
> > 
> valgrind also shows a use after free e.g. in gdb.base/commands.exp
> 
> Will investigate further ...

I have sent
  [RFA] Fix use after free introduced by $_hit_bpnum/$_hit_locno variables.
https://sourceware.org/pipermail/gdb-patches/2022-November/194014.html

that should fix the user after free.

Sorry for the breakage, thanks for reporting the issue.

Note that I did some verifications with valgrind, which highlighted some leaks:
  * some thread related data structure (probably not a big leak, there are not a lot of
    threads)
  * in command execution related to the mi interpreter
  * seems like some more big leaks in the dwarf reader
(see below)

If I have some more time this week-end, I might investigate the dwarf reader leaks first.

Philippe

Here are leaks reported when running gdb.mi/mi-break.exp

==2133857== 
==2133857== HEAP SUMMARY:
==2133857==     in use at exit: 24,643,711 bytes in 24,500 blocks
==2133857==   total heap usage: 402,114 allocs, 377,614 frees, 176,035,340 bytes allocated
==2133857== 
==2133857== VALGRIND_GDB_ERROR_BEGIN
==2133857== 632 bytes in 1 blocks are definitely lost in loss record 6,861 of 7,483
==2133857==    at 0x4839F01: operator new(unsigned long) (vg_replace_malloc.c:434)
==2133857==    by 0x7CA7B5: new_thread (thread.c:247)
==2133857==    by 0x7CA7B5: add_thread_silent(process_stratum_target*, ptid_t) (thread.c:281)
==2133857==    by 0x5D7A25: inf_ptrace_target::create_inferior(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char**, int) (inf-ptrace.c:100)
==2133857==    by 0x624FC4: linux_nat_target::create_inferior(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char**, int) (linux-nat.c:978)
==2133857==    by 0x5E2EE1: run_command_1(char const*, int, run_how) (infcmd.c:469)
==2133857==    by 0x48DFD4: cmd_func(cmd_list_element*, char const*, int) (cli-decode.c:2543)
==2133857==    by 0x7D0781: execute_command(char const*, int) (top.c:692)
==2133857==    by 0x6761E1: mi_execute_cli_command(char const*, bool, char const*) (mi-main.c:2135)
==2133857==    by 0x6764F1: mi_cmd_exec_run(char const*, char**, int) (mi-main.c:477)
==2133857==    by 0x673B40: mi_cmd_execute(mi_parse*) (mi-main.c:2109)
==2133857==    by 0x675FDF: captured_mi_execute_command (mi-main.c:1816)
==2133857==    by 0x675FDF: mi_execute_command(char const*, int) (mi-main.c:1941)
==2133857==    by 0x66525B: mi_execute_command_wrapper (mi-interp.c:281)
==2133857==    by 0x66525B: mi_execute_command_input_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) (mi-interp.c:310)
==2133857==    by 0x571A27: gdb_readline_no_editing_callback(void*) (event-top.c:925)
==2133857==    by 0x571DDF: stdin_event_handler(int, void*) (event-top.c:541)
==2133857==    by 0x97D9C5: gdb_wait_for_event(int) [clone .part.0] (event-loop.cc:694)
==2133857==    by 0x97E1F3: gdb_wait_for_event (event-loop.cc:593)
==2133857==    by 0x97E1F3: gdb_do_one_event(int) (event-loop.cc:264)
==2133857==    by 0x647F19: start_event_loop (main.c:411)
==2133857==    by 0x647F19: captured_command_loop() (main.c:471)
==2133857==    by 0x649A44: captured_main (main.c:1330)
==2133857==    by 0x649A44: gdb_main(captured_main_args*) (main.c:1345)
==2133857==    by 0x3A0A0B: main (gdb.c:32)
==2133857== 
==2133857== VALGRIND_GDB_ERROR_END
==2133857== VALGRIND_GDB_ERROR_BEGIN
==2133857== 3,269 (32 direct, 3,237 indirect) bytes in 1 blocks are definitely lost in loss record 7,179 of 7,483
==2133857==    at 0x483E1E8: calloc (vg_replace_malloc.c:1340)
==2133857==    by 0x3F54B0: xcalloc (alloc.c:97)
==2133857==    by 0x609636: xcnew<ui_interp_info> (poison.h:122)
==2133857==    by 0x609636: get_interp_info (interps.c:63)
==2133857==    by 0x609636: interp_lookup_existing (interps.c:205)
==2133857==    by 0x609636: interp_lookup(ui*, char const*) (interps.c:228)
==2133857==    by 0x6099B2: set_top_level_interpreter(char const*) (interps.c:249)
==2133857==    by 0x7CD891: new_ui_command(char const*, int) (top.c:398)
==2133857==    by 0x48DFD4: cmd_func(cmd_list_element*, char const*, int) (cli-decode.c:2543)
==2133857==    by 0x7D0781: execute_command(char const*, int) (top.c:692)
==2133857==    by 0x572CBC: command_handler(char const*) (event-top.c:616)
==2133857==    by 0x57304C: command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) (event-top.c:860)
==2133857==    by 0x573660: gdb_rl_callback_handler(char*) (event-top.c:246)
==2133857==    by 0x87B65F: rl_callback_read_char (callback.c:290)
==2133857==    by 0x5720CD: gdb_rl_callback_read_char_wrapper_noexcept() (event-top.c:188)
==2133857==    by 0x573540: gdb_rl_callback_read_char_wrapper(void*) (event-top.c:221)
==2133857==    by 0x571DDF: stdin_event_handler(int, void*) (event-top.c:541)
==2133857==    by 0x97D9C5: gdb_wait_for_event(int) [clone .part.0] (event-loop.cc:694)
==2133857==    by 0x97E1F3: gdb_wait_for_event (event-loop.cc:593)
==2133857==    by 0x97E1F3: gdb_do_one_event(int) (event-loop.cc:264)
==2133857==    by 0x647F19: start_event_loop (main.c:411)
==2133857==    by 0x647F19: captured_command_loop() (main.c:471)
==2133857==    by 0x649A44: captured_main (main.c:1330)
==2133857==    by 0x649A44: gdb_main(captured_main_args*) (main.c:1345)
==2133857==    by 0x3A0A0B: main (gdb.c:32)
==2133857== 
==2133857== VALGRIND_GDB_ERROR_END
==2133857== VALGRIND_GDB_ERROR_BEGIN
==2133857== 43,165 bytes in 1,801 blocks are definitely lost in loss record 7,450 of 7,483
==2133857==    at 0x483979B: malloc (vg_replace_malloc.c:393)
==2133857==    by 0x3F5434: xmalloc (alloc.c:57)
==2133857==    by 0x96B83E: xstrdup (xstrdup.c:34)
==2133857==    by 0x5380F1: dw2_get_file_names_reader (read.c:2825)
==2133857==    by 0x5380F1: dw2_get_file_names(dwarf2_per_cu_data*, dwarf2_per_objfile*) (read.c:2851)
==2133857==    by 0x538D1C: dw_expand_symtabs_matching_file_matcher(dwarf2_per_objfile*, gdb::function_view<bool (char const*, bool)>) (read.c:4149)
==2133857==    by 0x557855: cooked_index_functions::expand_symtabs_matching(objfile*, gdb::function_view<bool (char const*, bool)>, lookup_name_info const*, gdb::function_view<bool (char const*)>, gdb::function_view<bool (compunit_symtab*)>, enum_flags<block_search_flag_values>, domain_enum, search_domain) (read.c:18679)
==2133857==    by 0x777F5A: objfile::map_symtabs_matching_filename(char const*, char const*, gdb::function_view<bool (symtab*)>) (symfile-debug.c:207)
==2133857==    by 0x78B23C: iterate_over_symtabs(char const*, gdb::function_view<bool (symtab*)>) (symtab.c:633)
==2133857==    by 0x78B2F4: lookup_symtab(char const*) (symtab.c:647)
==2133857==    by 0x464FCA: classify_name(parser_state*, block const*, bool, bool) (c-exp.y:3086)
==2133857==    by 0x46705F: c_yylex() (c-exp.y:3254)
==2133857==    by 0x467B3B: c_yyparse() (c-exp.c.tmp:2037)
==2133857==    by 0x46FB3B: c_parse(parser_state*) (c-exp.y:3420)
==2133857==    by 0x6A312D: parse_exp_in_context(char const**, unsigned long, block const*, int, bool, innermost_block_tracker*, std::unique_ptr<expr_completion_base, std::default_delete<expr_completion_base> >*) (parse.c:515)
==2133857==    by 0x6A33C0: parse_exp_1(char const**, unsigned long, block const*, int, innermost_block_tracker*) (parse.c:428)
==2133857==    by 0x44EFF8: create_breakpoint(gdbarch*, location_spec*, char const*, int, char const*, bool, int, int, bptype, int, auto_boolean, breakpoint_ops const*, int, int, int, unsigned int) (breakpoint.c:9034)
==2133857==    by 0x65B884: mi_cmd_break_insert_1(int, char const*, char**, int) [clone .constprop.0] (mi-cmd-break.c:360)
==2133857==    by 0x673B40: mi_cmd_execute(mi_parse*) (mi-main.c:2109)
==2133857==    by 0x675FDF: captured_mi_execute_command (mi-main.c:1816)
==2133857==    by 0x675FDF: mi_execute_command(char const*, int) (mi-main.c:1941)
==2133857==    by 0x66525B: mi_execute_command_wrapper (mi-interp.c:281)
==2133857==    by 0x66525B: mi_execute_command_input_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) (mi-interp.c:310)
==2133857==    by 0x571A27: gdb_readline_no_editing_callback(void*) (event-top.c:925)
==2133857==    by 0x571DDF: stdin_event_handler(int, void*) (event-top.c:541)
==2133857==    by 0x97D9C5: gdb_wait_for_event(int) [clone .part.0] (event-loop.cc:694)
==2133857==    by 0x97E1F3: gdb_wait_for_event (event-loop.cc:593)
==2133857==    by 0x97E1F3: gdb_do_one_event(int) (event-loop.cc:264)
==2133857==    by 0x647F19: start_event_loop (main.c:411)
==2133857==    by 0x647F19: captured_command_loop() (main.c:471)
==2133857==    by 0x649A44: captured_main (main.c:1330)
==2133857==    by 0x649A44: gdb_main(captured_main_args*) (main.c:1345)
==2133857==    by 0x3A0A0B: main (gdb.c:32)
==2133857== 



      reply	other threads:[~2022-11-20 10:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-12 22:41 Philippe Waroquiers
2022-11-18 20:17 ` Tom Tromey
2022-11-20  2:06 ` Simon Marchi
2022-11-20  8:35   ` Philippe Waroquiers
2022-11-20 10:54     ` Philippe Waroquiers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75718637483e4eb742006ebc514dd51607070326.camel@skynet.be \
    --to=philippe.waroquiers@skynet.be \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).