Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Guinevere Larsen <guinevere@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb, gdbsupport, gdbserver: add support for printf 't' length modifier
Date: Tue, 20 Jan 2026 09:29:53 -0300	[thread overview]
Message-ID: <1bed1d63-c118-41f5-b690-bbe445be9af3@redhat.com> (raw)
In-Reply-To: <5f4ce462-c6a2-4b87-ab22-c159251678a6@polymtl.ca>

On 1/19/26 3:09 PM, Simon Marchi wrote:
> On 1/19/26 12:29 PM, Guinevere Larsen wrote:
>> On 1/12/26 3:24 PM, simon.marchi@polymtl.ca wrote:
>>> From: Simon Marchi <simon.marchi@polymtl.ca>
>>>
>>> Tom de Vries reported [1] that a use of the `t` printf length modifier
>>> (used for ptrdiff_t) breaks "set debug dwarf-die 1":
>>>
>>>       +break -qualified main
>>>       Reading Reading compcomp unit at offset  unit at offset 0x00x39
>>>
>>>       Reading comp unit at offset 0x1a8
>>>       Reading comp unit at offset 0x1e9
>>>       Reading comp unit at offset 0x2c5
>>>       Reading comp unit at offset 0x2a2
>>>       Reading comp unit at offset 0x904
>>>       Unrecognized format specifier 't' in printf
>>>
>>> This use is in dwarf2/read.c:
>>>
>>>         gdb_printf (gdb_stdlog, "Read die from %s@0x%tx of %s:\n",
>>>            m_die_section->get_name (),
>>>            (begin_info_ptr - m_die_section->buffer),
>>>            bfd_get_filename (m_abfd));
>>>
>>> Add support for the `t` length modifier in format_pieces, which
>>> gdb_printf ultimately uses (through ui_out::vmessage).  Modify the three
>>> users of format_pieces: gdb's printf command, gdb's ui_out::vmessage
>>> function and gdbserver's ax_printf function.
>>>
>>> The implementation is mostly copied from what we do for size_t.
>>>
>>> Since format_pieces is also used to implement the printf command, this
>>> patch brings user-visible changes.  Before:
>>>
>>>       (gdb) printf "%td\n", -123
>>>       ❌️ Unrecognized format specifier 't' in printf
>>>
>>> After:
>>>
>>>       (gdb) printf "%td\n", -123
>>>       -123
>>>
>>> [1] https://inbox.sourceware.org/gdb-patches/d4ccce34-aad5-4e3d-8fc9-efb2fc11275c@suse.de/
>>>
>>> Change-Id: Ie9fce78f5f48082d8f8a9ca2847b5ae26acaa60d
>>> ---
>> This commit seems to have caused a regression. After this, when starting GDB without the quiet flag I get the following:
>>
>> 0x7ffc6b9bc520s
>> Copyright (C) 2026 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <0x7ffc6b9bc560s>
>> This is free software: you are free to change and redistribute it
>> There is NO WARRANTY, to the extent permitted by law.
>> Type "0x7ffc6b9bc5e0s" and "0x7ffc6b9bc5a0s" for details.
>> This GDB was configured as "x86_64-pc-linux-gnu".
>> Type "0x7ffc6b9bc620s" for configuration details.
>> For bug reporting instructions, please see:
>> 0x7ffc6b9bc660s.
>>
>> That is, anywhere where GDB would print a styled string, we seem to be printing a pointer address instead.
>
> Hmm, I don't see this.  I see a pink "GNU gdb (GDB)
> 18.0.50.20260119-git" where you see the "0x7ffc6b9bc660s".
> We will need to figure out what is different between our setups.
>
> Simon
>
Oh, oops, turns out it was my bad.

I was running make on the gdb subdirectory instead of the build 
directory and never compiled gdbsupport

Once I did that things magically started working again!


Sorry about the noise

-- 
Cheers,
Guinevere Larsen
It/she


      reply	other threads:[~2026-01-20 12:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 18:24 simon.marchi
2026-01-15 19:24 ` Tom Tromey
2026-01-15 19:36   ` Simon Marchi
2026-01-15 19:42     ` Tom Tromey
2026-01-19 17:29 ` Guinevere Larsen
2026-01-19 18:09   ` Simon Marchi
2026-01-20 12:29     ` Guinevere Larsen [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=1bed1d63-c118-41f5-b690-bbe445be9af3@redhat.com \
    --to=guinevere@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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