Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2024 18:51:47 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        =?utf-8?Q?Bojan_Novkovi=C4=87?= <bnovkov@FreeBSD.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: aada453dcbaa - main - ddb: Properly pretty-print non-labeled enum values
Message-ID:  <452E6F8D-21DC-47B6-AE4F-F4A2C4790F0B@freebsd.org>
In-Reply-To: <202404031618.433GIPbq096540@gitrepo.freebsd.org>
References:  <202404031618.433GIPbq096540@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3 Apr 2024, at 17:18, Bojan Novkovi=C4=87 <bnovkov@FreeBSD.org> =
wrote:
>=20
> The branch main has been updated by bnovkov:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Daada453dcbaab1b8f7d50b66add5a38e=
b9e06cc3
>=20
> commit aada453dcbaab1b8f7d50b66add5a38eb9e06cc3
> Author:     Bojan Novkovi=C4=87 <bnovkov@FreeBSD.org>
> AuthorDate: 2024-04-03 15:47:00 +0000
> Commit:     Bojan Novkovi=C4=87 <bnovkov@FreeBSD.org>
> CommitDate: 2024-04-03 16:17:11 +0000
>=20
>    ddb: Properly pretty-print non-labeled enum values
>=20
>    The ddb pretty-printer currently does not print out enum values =
that
>    are not labeled (e.g. X | Y).
>    The enum printer was reworked to print non-labeled values.
>=20
>    Reported by:    jrtc27
>    Fixes:  c21bc6f ("ddb: Add CTF-based pretty printing")
>    Approved by:    markj (mentor)
> ---
> sys/ddb/db_pprint.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>=20
> diff --git a/sys/ddb/db_pprint.c b/sys/ddb/db_pprint.c
> index 8aa14550f068..b4116372cf65 100644
> --- a/sys/ddb/db_pprint.c
> +++ b/sys/ddb/db_pprint.c
> @@ -225,13 +225,14 @@ db_pprint_enum(db_addr_t addr, struct =
ctf_type_v3 *type, u_int depth)
> for (; ep < endp; ep++) {
> if (val =3D=3D ep->cte_value) {
> valname =3D db_ctf_stroff_to_str(&sym_data, ep->cte_name);
> - if (valname !=3D NULL)
> - db_printf("%s (0x%lx)", valname, (long)val);
> - else
> - db_printf("(0x%lx)", (long)val);
> - break;
> + if (valname !=3D NULL) {
> + db_printf("%s (0x%lx)", valname, val);
> + break;
> + }

This ignored the "(well, with 32-bit fixed)" part of my review comment =
for that
suggestion and rolled back d722901fa3a2 ("ddb: Fix format string errors =
in
db_pprint.c").

Jess

> }
> }
> + if (ep =3D=3D endp)
> + db_printf("0x%lx", val);
> }
>=20
> /*




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?452E6F8D-21DC-47B6-AE4F-F4A2C4790F0B>