From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id C13663895FFC for ; Sun, 20 Nov 2022 02:06:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C13663895FFC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 926DA1E0CB; Sat, 19 Nov 2022 21:06:39 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1668909999; bh=Oubg7kFaW52WllX7QBlOjoJMLEaimUQr3GnnPcQbs0E=; h=Date:Subject:To:References:From:In-Reply-To:From; b=OO2IrZAsz7aEk855F/+3A3jfKpgV1yxZD4mt36zep566sCWkBknZbmZufxWlXgR0q TafNyV/DoELgAI3GLjxx/Ag9TEdB2WfUOIiXNawkdDZXfI4U24D7nJ1y26l0ADgt23 7WxJNjczzvxVMG7U0vReYUWrCLNSNARsH8eCsCKA= Message-ID: <563d4081-5eda-6c9c-048d-0db1a77bfd8f@simark.ca> Date: Sat, 19 Nov 2022 21:06:38 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [RFAv4] Show locno for 'multi location' breakpoint hit msg+conv var $_hit_bbnum $_hit_locno. Content-Language: en-US To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20221112224146.3148234-1-philippe.waroquiers@skynet.be> From: Simon Marchi In-Reply-To: <20221112224146.3148234-1-philippe.waroquiers@skynet.be> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/12/22 17:41, Philippe Waroquiers via Gdb-patches wrote: > Before this patch, when a breakpoint that has multiple locations is reached, > GDB printed: > Thread 1 "zeoes" hit Breakpoint 1, some_func () at somefunc1.c:5 > > This patch changes the message so that bkpt_print_id prints the precise > encountered breakpoint: > Thread 1 "zeoes" hit Breakpoint 1.2, some_func () at somefunc1.c:5 > > In mi mode, bkpt_print_id also (optionally) prints a new table field "locno": > locno is printed when the breakpoint hit has more than one location. > Note that according to the GDB user manual node 'GDB/MI Development and Front > Ends', it is ok to add new fields without changing the MI version. > > Also, when a breakpoint is reached, the convenience variables > $_hit_bpnum and $_hit_locno are set to the encountered breakpoint number > and location number. > > $_hit_bpnum and $_hit_locno can a.o. be used in the command list of a > breakpoint, to disable the specific encountered breakpoint, e.g. > disable $_hit_bpnum.$_hit_locno > > In case the breakpoint has only one location, $_hit_locno is set to > the value 1, so as to allow a command such as: > disable $_hit_bpnum.$_hit_locno > to disable the breakpoint even when the breakpoint has only one location. > > This also fixes a strange behaviour: when a breakpoint X has only > one location, > enable|disable X.1 > is accepted but transforms the breakpoint in a multiple locations > breakpoint having only one location. > > The changes in RFA v4 handle the comments of Tom Tromey: > - Changed convenience var names from $bkptno/$locno to > $_hit_bpnum/$_hit_locno. > - updated the tests and user manual accordingly. > User manual also explictly describes that $_hit_locno is set to 1 > for a breakpoint with a single location. > - The variable values are now set in bpstat_do_actions_1 so that > they are set for silent breakpoints, and when several breakpoints > are hit at the same time, that the variables are set to the printed > breakpoint. > > The changes in RFA v3 handle the additional comments of Eli: > GDB/NEW: > - Use max 80-column > - Use 'code location' instead of 'location'. > - Fix typo $bkpno > - Ensure that disable $bkptno and disable $bkptno.$locno have > each their explanation inthe example > - Reworded the 'breakpoint-hit' paragraph. > gdb.texinfo: > - Use 'code location' instead of 'location'. > - Add a note to clarify the distinction between $bkptno and $bpnum. > - Use @kbd instead of examples with only one command. > > Compared to RFA v1, the changes in v2 handle the comments given by > Keith Seitz and Eli Zaretskii: > - Use %s for the result of paddress > - Use bkptno_numopt_re instead of 2 different -re cases > - use C@t{++} > - Add index entries for $bkptno and $locno > - Added an example for "locno" in the mi interface > - Added examples in the Break command manual. Hi Philippe, I am getting some new failures starting with your patch, at least when building with ASan. I bisected using gdb.mi/mi-break.exp as a test: PASS: gdb.mi/mi-break.exp: mi-mode=main: test_breakpoint_commands: intermediate stop and continue, mi running ================================================================= ==1105569==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000055110 at pc 0x55eabe71b268 bp 0x7ffcc2697a20 sp 0x7ffcc2697a10 READ of size 8 at 0x606000055110 thread T0 #0 0x55eabe71b267 in set_hit_convenience_vars /home/simark/src/binutils-gdb/gdb/breakpoint.c:4581 #1 0x55eabe71b7b5 in bpstat_do_actions_1 /home/simark/src/binutils-gdb/gdb/breakpoint.c:4698 #2 0x55eabe71ba45 in bpstat_do_actions() /home/simark/src/binutils-gdb/gdb/breakpoint.c:4731 #3 0x55eabefd4b62 in inferior_event_handler(inferior_event_type) /home/simark/src/binutils-gdb/gdb/inf-loop.c:70 #4 0x55eabf03f005 in fetch_inferior_event() /home/simark/src/binutils-gdb/gdb/infrun.c:4270 #5 0x55eabefd4a4f in inferior_event_handler(inferior_event_type) /home/simark/src/binutils-gdb/gdb/inf-loop.c:41 #6 0x55eabf0661c2 in infrun_async_inferior_event_handler /home/simark/src/binutils-gdb/gdb/infrun.c:9554 #7 0x55eabe6728bb in check_async_event_handlers() /home/simark/src/binutils-gdb/gdb/async-event.c:337 #8 0x55eac00a6cda in gdb_do_one_event(int) /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:221 #9 0x55eabf1ebbfb in start_event_loop /home/simark/src/binutils-gdb/gdb/main.c:411 #10 0x55eabf1ebf15 in captured_command_loop /home/simark/src/binutils-gdb/gdb/main.c:471 #11 0x55eabf1f03cb in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1330 #12 0x55eabf1f045b in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1345 #13 0x55eabe4bfe6d in main /home/simark/src/binutils-gdb/gdb/gdb.c:32 #14 0x7fad6ce2a28f (/usr/lib/libc.so.6+0x2328f) #15 0x7fad6ce2a349 in __libc_start_main (/usr/lib/libc.so.6+0x23349) #16 0x55eabe4bfc34 in _start ../sysdeps/x86_64/start.S:115 0x606000055110 is located 16 bytes inside of 56-byte region [0x606000055100,0x606000055138) freed by thread T0 here: #0 0x7fad6de0b78a in operator delete(void*, unsigned long) /usr/src/debug/gcc/libsanitizer/asan/asan_new_delete.cpp:164 #1 0x55eabe71a14e in bpstat_clear(bpstat**) /home/simark/src/binutils-gdb/gdb/breakpoint.c:4370 #2 0x55eabf03380d in clear_proceed_status_thread /home/simark/src/binutils-gdb/gdb/infrun.c:2781 #3 0x55eabf033e9e in clear_proceed_status(int) /home/simark/src/binutils-gdb/gdb/infrun.c:2808 #4 0x55eabeff4dab in continue_1(int) /home/simark/src/binutils-gdb/gdb/infcmd.c:659 #5 0x55eabeff5531 in continue_command /home/simark/src/binutils-gdb/gdb/infcmd.c:752 #6 0x55eabe92b954 in do_simple_func /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:95 #7 0x55eabe939998 in cmd_func(cmd_list_element*, char const*, int) /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:2543 #8 0x55eabf9986c2 in execute_command(char const*, int) /home/simark/src/binutils-gdb/gdb/top.c:692 #9 0x55eabe973c1d in execute_control_command_1 /home/simark/src/binutils-gdb/gdb/cli/cli-script.c:528 #10 0x55eabe974b41 in execute_control_command(command_line*, int) /home/simark/src/binutils-gdb/gdb/cli/cli-script.c:708 #11 0x55eabe71b652 in bpstat_do_actions_1 /home/simark/src/binutils-gdb/gdb/breakpoint.c:4661 #12 0x55eabe71ba45 in bpstat_do_actions() /home/simark/src/binutils-gdb/gdb/breakpoint.c:4731 #13 0x55eabefd4b62 in inferior_event_handler(inferior_event_type) /home/simark/src/binutils-gdb/gdb/inf-loop.c:70 #14 0x55eabf03f005 in fetch_inferior_event() /home/simark/src/binutils-gdb/gdb/infrun.c:4270 #15 0x55eabefd4a4f in inferior_event_handler(inferior_event_type) /home/simark/src/binutils-gdb/gdb/inf-loop.c:41 #16 0x55eabf0661c2 in infrun_async_inferior_event_handler /home/simark/src/binutils-gdb/gdb/infrun.c:9554 #17 0x55eabe6728bb in check_async_event_handlers() /home/simark/src/binutils-gdb/gdb/async-event.c:337 #18 0x55eac00a6cda in gdb_do_one_event(int) /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:221 #19 0x55eabf1ebbfb in start_event_loop /home/simark/src/binutils-gdb/gdb/main.c:411 #20 0x55eabf1ebf15 in captured_command_loop /home/simark/src/binutils-gdb/gdb/main.c:471 #21 0x55eabf1f03cb in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1330 #22 0x55eabf1f045b in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1345 #23 0x55eabe4bfe6d in main /home/simark/src/binutils-gdb/gdb/gdb.c:32 #24 0x7fad6ce2a28f (/usr/lib/libc.so.6+0x2328f) previously allocated by thread T0 here: #0 0x7fad6de0a672 in operator new(unsigned long) /usr/src/debug/gcc/libsanitizer/asan/asan_new_delete.cpp:95 #1 0x55eabe7222ef in build_bpstat_chain(address_space const*, unsigned long, target_waitstatus const&) /home/simark/src/binutils-gdb/gdb/breakpoint.c:5591 #2 0x55eabf04dcfa in handle_signal_stop /home/simark/src/binutils-gdb/gdb/infrun.c:6334 #3 0x55eabf04a8fb in handle_inferior_event /home/simark/src/binutils-gdb/gdb/infrun.c:5866 #4 0x55eabf03ecb3 in fetch_inferior_event() /home/simark/src/binutils-gdb/gdb/infrun.c:4231 #5 0x55eabefd4a4f in inferior_event_handler(inferior_event_type) /home/simark/src/binutils-gdb/gdb/inf-loop.c:41 #6 0x55eabf0661c2 in infrun_async_inferior_event_handler /home/simark/src/binutils-gdb/gdb/infrun.c:9554 #7 0x55eabe6728bb in check_async_event_handlers() /home/simark/src/binutils-gdb/gdb/async-event.c:337 #8 0x55eac00a6cda in gdb_do_one_event(int) /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:221 #9 0x55eabf1ebbfb in start_event_loop /home/simark/src/binutils-gdb/gdb/main.c:411 #10 0x55eabf1ebf15 in captured_command_loop /home/simark/src/binutils-gdb/gdb/main.c:471 #11 0x55eabf1f03cb in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1330 #12 0x55eabf1f045b in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1345 #13 0x55eabe4bfe6d in main /home/simark/src/binutils-gdb/gdb/gdb.c:32 #14 0x7fad6ce2a28f (/usr/lib/libc.so.6+0x2328f) SUMMARY: AddressSanitizer: heap-use-after-free /home/simark/src/binutils-gdb/gdb/breakpoint.c:4581 in set_hit_convenience_vars 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 Simon