public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lsix@lancelotsix.com>
To: Simon Marchi <simon.marchi@efficios.com>
Cc: gdb-patches@sourceware.org, Simon Marchi <Simon.Marchi@amd.com>
Subject: Re: [PATCH] gdb: reject inserting breakpoints between functions
Date: Fri, 17 Jun 2022 16:25:00 +0000	[thread overview]
Message-ID: <20220617162125.pqcerpgquu5pruez@ubuntu.lan> (raw)
In-Reply-To: <20220408200536.235329-1-simon.marchi@efficios.com>

Hi,

I have just sent a patch[1] which sits on top of this one.  I do not think
there have been feedbacks on this yet, so I'd like to ping on this one on
behalf on Simon.

For what it is worth, I do agree with the change proposed changes as
it is a pre-requisite for what I am proposing in [1].

Thanks,
Lancelot.

[1] https://sourceware.org/pipermail/gdb-patches/2022-June/190150.html


> diff --git a/gdb/linespec.c b/gdb/linespec.c
> index 9d4707cbb4e7..dd31cf2a9fc4 100644
> --- a/gdb/linespec.c
> +++ b/gdb/linespec.c
> @@ -2133,11 +2140,44 @@ create_sals_line_offset (struct linespec_state *self,
>  	    struct symbol *sym = (blocks[i]
>  				  ? block_containing_function (blocks[i])
>  				  : NULL);
> +	    symtab_and_line *sal = &intermediate_results[i];
> +
> +	    /* Don't consider a match if:
> +
> +	        - the provided line did not give an exact match (so we started
> +	          looking for lines below until we found one with code
> +	          associated to it)
> +	        - the found location is exactly the start of a function
> +	        - the provided line is above the declaration line of the function
> +
> +	       Consider the following source:
> +
> +	       10 } // end of a previous function
> +	       11
> +	       12 int
> +	       13 main (void)
> +	       14 {
> +	       15   int i = 1;
> +	       16
> +	       17   return 0;
> +	       18 }
> +
> +	       The intent of this heuristic is that a breakpoint requested on
> +	       line 11 and 12 will not result on a breakpoint on main, but a
> +	       breakpoint on line 13 will.  A breakpoint requested on the empty
> +	       line 16 will also result in a breakpoint in main, at line 17.  */
> +	    if (!was_exact
> +		&& sym != nullptr
> +		&& sym->aclass () == LOC_BLOCK
> +		&& sal->pc == BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym))

The BLOCK_ENTRY_PC and SYMBOL_BLOCK_VALUE macros have been removed.
This should now be:

+		&& sal->pc == sym->value_block ()->entry_pc ()

> +		&& val.line < sym->line ())
> +	      continue;
>  
>  	    if (self->funfirstline)
> -	      skip_prologue_sal (&intermediate_results[i]);
> -	    intermediate_results[i].symbol = sym;
> -	    add_sal_to_sals (self, &values, &intermediate_results[i],
> +	      skip_prologue_sal (sal);
> +
> +	    sal->symbol = sym;
> +	    add_sal_to_sals (self, &values, sal,
>  			     sym ? sym->natural_name () : NULL, 0);
>  	  }
>      }

  reply	other threads:[~2022-06-17 16:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08 20:05 Simon Marchi
2022-06-17 16:25 ` Lancelot SIX [this message]
2022-06-21 17:01 ` Andrew Burgess
2024-04-30  8:47   ` Klaus Gerlicher
     [not found] ` <6630b03f.050a0220.6a68d.6289SMTPIN_ADDED_BROKEN@mx.google.com>
2024-05-01  9:47   ` Andrew Burgess
2024-05-01 18:11     ` Simon Marchi
2024-05-08 14:26       ` Andrew Burgess

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=20220617162125.pqcerpgquu5pruez@ubuntu.lan \
    --to=lsix@lancelotsix.com \
    --cc=Simon.Marchi@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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).