From: Joel Brobecker <brobecker@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] Fix running to breakpoint set in inline function by lineno/address
Date: Thu, 28 Jun 2018 17:32:00 -0000 [thread overview]
Message-ID: <20180628173254.GB2511@adacore.com> (raw)
In-Reply-To: <20180628145035.24713-1-palves@redhat.com>
> Commit 61b04dd04ac2 ("Change inline frame breakpoint skipping logic
> (fix gdb.gdb/selftest.exp)") caused a GDB crash when you set a
> breakpoint by line number in an inline function, and then run to the
> breakpoint:
>
> $ gdb -q test Reading symbols from test...done.
> (gdb) b inline-break.c:32
> Breakpoint 1 at 0x40062f: file inline-break.c, line 32.
> (gdb) run
> Starting program: /[...]/test
> [1] 75618 segmentation fault /[...]/gdb -q test
>
> The problem occurs because we assume that a bp_location's symbol is
> not NULL, which is not true when we set the breakpoint with a linespec
> location:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000006f42bb in stopped_by_user_bp_inline_frame (
> stop_chain=<optimized out>, frame_block=<optimized out>)
> at gdb/inline-frame.c:305
> 305 && frame_block == SYMBOL_BLOCK_VALUE (loc->symbol))
> (gdb) p loc->symbol
> $1 = (const symbol *) 0x0
>
> The same thing happens if you run to a breakpoint set in an inline
> function by address:
>
> (gdb) b *0x40062f
> Breakpoint 3 at 0x40062f: file inline-break.c, line 32.
>
> To fix this, add a null pointer check, to avoid the crash, and make it
> so that if there's not symbol for the location, then we present the
> stop at the inline function. This preserves the previous behavior
> when e.g., setting a breakpoint by address, with "b *ADDRESS".
>
> gdb/ChangeLog:
> yyyy-mm-dd Pedro Alves <palves@redhat.com>
>
> * inline-frame.c (stopped_by_user_bp_inline_frame): Return
> true if the the location has no symbol.
>
> gdb/testsuite/ChangeLog:
> yyyy-mm-dd Pedro Alves <palves@redhat.com>
>
> * gdb.opt/inline-break.c (func1): Add "break here" marker.
> * gdb.opt/inline-break.exp: Test setting breakpoints by line
> number and address and running to them.
Thanks, Pedro. I had a look, and FWIW, the patch looks good to me.
--
Joel
next prev parent reply other threads:[~2018-06-28 17:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 15:06 [PATCH] Ensure captured_main has unique address Tom de Vries
2018-06-12 17:38 ` Change inline frame breakpoint skipping logic (Re: [PATCH] Ensure captured_main has unique address) Pedro Alves
2018-06-14 13:22 ` Tom de Vries
[not found] ` <8c7ace90-f0b8-56f0-0033-5b7827796037@redhat.com>
2018-06-25 21:04 ` [pushed] Change inline frame breakpoint skipping logic (fix gdb.gdb/selftest.exp) Joel Brobecker
2018-06-26 19:02 ` Pedro Alves
2018-06-26 22:02 ` Joel Brobecker
2018-06-27 16:28 ` Pedro Alves
2018-06-28 14:48 ` Pedro Alves
2018-06-28 14:50 ` [PATCH 1/2] Fix running to breakpoint set in inline function by lineno/address Pedro Alves
2018-06-28 17:32 ` Joel Brobecker [this message]
2018-06-28 14:50 ` [PATCH 2/2] "break LINENO/*ADDRESS", inline functions and "info break" output Pedro Alves
2018-06-28 17:42 ` Joel Brobecker
2018-06-29 18:43 ` Pedro Alves
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=20180628173254.GB2511@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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