Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] "break LINENO/*ADDRESS", inline functions and "info break" output
Date: Thu, 28 Jun 2018 17:42:00 -0000	[thread overview]
Message-ID: <20180628174203.GC2511@adacore.com> (raw)
In-Reply-To: <20180628145035.24713-2-palves@redhat.com>

Hi Pedro,

> While experimenting with the previous patch, I noticed this inconsistency
> in GDB's output:
[...]
> When we run to the breakpoint, we present the stop at the same line
> number, and correctly show "func1" as the function name (2).
> 
> But in "info break" output (3), notice that we say "in main", not "in
> func1".

> (It seems odd to me that block_linkage_function says "the CONTAINING
> function will be returned", and then block_containing_function says it
> returns "the closest enclosing function".  Something seems reversed
> here.  Still, I've kept the same nomenclature and copied the comments,
> so that at least there's consistency.  Maybe we should fix that up
> somehow.)

That seems opposite to me as well...

> Then I wondered, why make print_breakpoint_location look up the symbol
> every time it is called, instead of just always storing the symbol
> when the location is created, since the location already stores the
> symbol in some cases.

Agreed.

> So to find which cases might be missing setting
> the symbol in the sal which is used to create the breakpoint location,
> I added an assertion to print_breakpoint_location, and ran the
> testsuite.  That caught a few places, unsurprisingly:
> 
>  - setting a breakpoint by line number
>  - setting a breapoint by address
>  - ifunc resolving
> 
> Those are all fixed by this commit.

Nice approach!

> I decided not to add the
> assertion to block_linkage_function and leave the existing "if (sym)"
> check in place, because it's plausible that we have symtabs with line
> info but no symbols.  I.e., that would not be a GDB bug, but
> a peculiarity of debug info input.

Agreed as well.

> gdb/ChangeLog:
> yyyy-mm-dd  Pedro Alves  <palves@redhat.com>
> 
> 	* blockframe.c (find_pc_sect_containing_function): New function.
> 	* breakpoint.c (print_breakpoint_location): Don't call
> 	find_pc_sect_function.
> 	* linespec.c (create_sals_line_offset): Record the location's
> 	symbol in the sal.
> 	* linespec.c (convert_address_location_to_sals): Fill in sal's
> 	symbol with find_pc_sect_containing_function.
> 	* symtab.c (find_function_start_sal): Rename to ...
> 	(find_function_start_sal_1): ... this.
> 	(find_function_start_sal): Reimplement as wrapper around
> 	find_function_start_sal_1, and use
> 	find_pc_sect_containing_function to fill in the sal's symbol.
> 	(find_function_start_sal(symbol*, bool)): Adjust.
> 	* symtab.h (find_pc_function, find_pc_sect_function): Adjust
> 	comments.
> 	(find_pc_sect_containing_function): Declare.

I know it might be considered a small and trivial part, but I really
appreciate the attention to the function's comment description.

> 
> gdb/testsuite/ChangeLog:
> yyyy-mm-dd  Pedro Alves  <palves@redhat.com>
> 
> 	* gdb.opt/inline-break.exp (line number, address): Add "info
> 	break" tests.

I went through the patch and it looks good.

Thanks again!
-- 
Joel


  reply	other threads:[~2018-06-28 17:42 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
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 [this message]
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=20180628174203.GC2511@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