Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Gregori Mignerot <gregori.mignerot@laposte.net>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH v3] [gdb] Support default locations in DWARF5 loclists
Date: Mon, 27 Apr 2026 14:34:30 -0400	[thread overview]
Message-ID: <57efa500-e317-4c37-9d51-946d09102e48@simark.ca> (raw)
In-Reply-To: <20260427175528.1272510-1-gregori.mignerot@laposte.net>

On 4/27/26 1:50 PM, Gregori Mignerot wrote:
> Add support and a test for default location entries in DWARF5 loclists
> (DW_LLE_default_location, section 2.6.2 in the DWARF5 standard)
> ---
> Applied the review comments from v2
> 
>> Are you able to mention some producers that produce default locations,
>> so we can look?
> Problem is, the producers I've found are DWARF linkers or assemblers,
> so they don't have a strong opinion on the matter, ex. [1][2].
> Also llvm-dwarfdump --verify doesn't complain about misplaced default
> location entries but that's probably because it's not checked at all.

Ok, and just out of curiosity (since you don't mention any producers
that use DW_LLE_default_location), does the motivation for this change
come from a real-world use case?

>> If we don't need to support non-conforming implementations, I think we
>> could stick to what the spec says, it would make the code a little bit
>> simpler: when encountering a DW_LLE_default_location, you can return
>> this that expression right away, instead of saving it to a local
>> variable to be returned later.
> You're right, since there's no precedent that's simpler.
> Changed it in v3.

git-am complains about these whitespace errors:

Applying: Support default locations in DWARF5 loclists
/home/smarchi/src/binutils-gdb/.git/rebase-apply/patch:85: trailing whitespace.
	
/home/smarchi/src/binutils-gdb/.git/rebase-apply/patch:113: indent with spaces.
	                               addr_size, offset_size,
/home/smarchi/src/binutils-gdb/.git/rebase-apply/patch:114: indent with spaces.
	                               dlbaton->per_cu, per_objfile);

If you configure pre-commit [1], it will also point those out:

$ pre-commit run --all-files
...
check-whitespace.........................................................Failed
- hook id: check-whitespace
- exit code: 2

gdb/dwarf2/loc.c:4059: trailing whitespace.
+	
gdb/dwarf2/loc.c:4091: indent with spaces.
+	                               addr_size, offset_size,
gdb/dwarf2/loc.c:4092: indent with spaces.
+	                               dlbaton->per_cu, per_objfile);

[1] https://sourceware.org/gdb/wiki/DeveloperTips#Setting_up_pre-commit

> @@ -458,6 +466,12 @@ dwarf2_find_location_expression (const dwarf2_loclist_baton *baton,
>  	  loc_ptr += bytes_read;
>  	}
>  
> +      if (kind == DEBUG_LOC_DEFAULT_LOCATION)
> +	{
> +	  *locexpr_length = length;
> +	  return loc_ptr;
> +	}

I would just add a comment like this above:

      /* DW_LLE_default_location can only appear as the last entry
         (other than the "end of list" entry) of a location list.  If we
	 see it, we know we don't have to search further.  */

Otherwise, the patch LGTM, we just need to wait for your copyright
assignment to be complete, let us know when that is done.

Simon

      reply	other threads:[~2026-04-27 18:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 17:50 Gregori Mignerot
2026-04-27 18:34 ` Simon Marchi [this message]

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=57efa500-e317-4c37-9d51-946d09102e48@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=gregori.mignerot@laposte.net \
    /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