public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug breakpoints/26096] New: gdb sets breakpoint at cold clone Date: Tue, 09 Jun 2020 10:57:58 +0000 [thread overview] Message-ID: <bug-26096-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=26096 Bug ID: 26096 Summary: gdb sets breakpoint at cold clone Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: breakpoints Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- Consider test-case test.c: ... $ cat test.c #include <stdlib.h> int a; int b; int c; static int __attribute__((used, noinline, noclone)) foo (void) { a = 2; if (b) abort (); return c; } static int __attribute__((used, noinline, noclone)) bar (void) { a = 1; if (c) abort (); return b; } int main (int argc, char **) { b = argc * 2; c = argc / 2; if (b + c == 5) abort (); return foo () + bar (); } ... Compiled with gcc-10: ... $ g++-10 test.c -O2 -g -Wall -Wextra ... The functions foo and bar get split into a hot and cold part by gcc's freorder-blocks-and-partition: ... $ nm a.out | c++filt | egrep "foo|bar" 00000000004005b0 t bar() 0000000000400455 t bar() [clone .cold] 0000000000400580 t foo() 0000000000400450 t foo() [clone .cold] ... When we set breakpoints on foo and bar however, we get two breakpoint locations per function: ... $ gdb -batch a.out -ex "b foo" -ex "b bar" -ex "info break" Breakpoint 1 at 0x400450: foo. (2 locations) Breakpoint 2 at 0x400455: bar. (2 locations) Num Type Disp Enb Address What 1 breakpoint keep y <MULTIPLE> 1.1 y 0x0000000000400450 in foo() at test.c:12 1.2 y 0x0000000000400580 in foo() at test.c:10 2 breakpoint keep y <MULTIPLE> 2.1 y 0x0000000000400455 in bar() at test.c:22 2.2 y 0x00000000004005b0 in bar() at test.c:20 ... So, the cold part of the function gets its own breakpoint. In other words, we have: ... $ gdb -q a.out Reading symbols from a.out... (gdb) b foo Breakpoint 1 at 0x400450: foo. (2 locations) (gdb) r Starting program: /home/vries/a.out Breakpoint 1, foo () at test.c:10 10 a = 2; (gdb) c Continuing. Breakpoint 1, foo () at test.c:12 12 abort (); ... -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2020-06-09 10:57 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-09 10:57 vries at gcc dot gnu.org [this message] 2020-06-09 13:17 ` [Bug breakpoints/26096] " vries at gcc dot gnu.org 2020-06-09 14:23 ` vries at gcc dot gnu.org 2021-05-29 10:38 ` vries at gcc dot gnu.org 2021-05-31 14:16 ` vries at gcc dot gnu.org 2021-05-31 14:35 ` vries at gcc dot gnu.org 2021-05-31 17:06 ` bernd.edlinger at hotmail dot de 2021-06-01 13:25 ` cvs-commit at gcc dot gnu.org 2021-06-01 13:33 ` vries at gcc dot gnu.org 2021-06-01 13:33 ` vries at gcc dot gnu.org 2021-06-01 14:14 ` bernd.edlinger at hotmail dot de
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=bug-26096-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /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: linkBe 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).