From nobody Thu Jun 29 08:20:42 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QsBGf5ZYvz4knvX; Thu, 29 Jun 2023 08:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QsBGf4LsBz3w58; Thu, 29 Jun 2023 08:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688026842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uzabykX2n+qOJR5r6koFgoOSaL50ezX2b5I+/PWhCCI=; b=EDZJ5lRxD8GTlFtNgkMNBlDnJMf0nZi6tF12VDT9EnJFgHq/5i41hKg/Y7LUNj6OXBk7Ps 8wK+ccUGLLR+ttRqE9YY7jomvojjOP/COx3MiFai+nXOr6P2GlUMbMyS0CuwqiEO2Gi+gT rrzBCpB8HmHGmt4yQFYtopBDhGoMOWb6mov+fgYWD3Iv7vAEdVXsgKOAunwN4RZNzyJcZK n4MzjkL7bq8DfOI80kcWTXOadoJfatDerLoZIsaip/QJKD4GNur5UTqr1CuB0Rt+aqxypi olRYboyA5jJLxY0edzoKOib9yYY0CmK9yGReqdt7kCQVPJfzEna3CRhDQHxvyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688026842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uzabykX2n+qOJR5r6koFgoOSaL50ezX2b5I+/PWhCCI=; b=hNXchIhypk40yPd6VCrOYuhYZmYjnOfWgkOuKdYPSy9aZv7o0WZhy2ksOpm85lksx/4th3 n8D7BW+mKvMEXr2xBX+9aldzy1zSAmg+k2WnKXM4fVNiHkA/FgodfKbIOi9IlcE2wdxYrl flOtiA0WSJvkk+gjpp8fJMsg7rG+fuYaQWxhYscQCHLqQjASV+kQoDa6CFcNvEyr4Qjk+L UOhUl1L5S+kO75XqxRh7L49bwrX843pdmuGeiIV9TOez3c/rPsjOHBrcVvZUa1+Z5BDLYn /JFzIWArYuiEJtIORbm0ccuZVa02RXGMn4o23fl5u8C+ydv7mpi4phQm4jxGjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688026842; a=rsa-sha256; cv=none; b=saEZ9r5xp8UX/3PPbdbAtTIBn1+AHMuRXP1GQGsFGg00J0wuDsiHjqd5zYaV1EQThtzukA Xd0hisr7qO+GXR5uwOwKNed73ecqn4kHIhql8x90AcktxLBsMb+vqzFRdP52/8myYjYSg7 N3TylWFSXZ79Y+A3TggDP0tyYbiE3KRqVtOH6oKQmCu7kkD+edTh6/jpt2tX2P+fUPo01w GnFGjCj0e3aP1vyHI9qgGofi3b6iN9i5LdQRez++8TivNbqKRbzyTefzGASoBMGDpeAf5k J1Oxkq8nCVULdn3RaUfCwnVxJtvDGGTrcK/jXfM0KhQl68cuOG58qpsSi4Qvlw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QsBGf3FjYz17sm; Thu, 29 Jun 2023 08:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 35T8KgKI084630; Thu, 29 Jun 2023 08:20:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 35T8KgMq084629; Thu, 29 Jun 2023 08:20:42 GMT (envelope-from git) Date: Thu, 29 Jun 2023 08:20:42 GMT Message-Id: <202306290820.35T8KgMq084629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 8bfdf839270b - stable/13 - kdump: Add a facility to print numbers in decimal format always List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8bfdf839270b3c9be013ec4b51ef8fdc1fe80636 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=8bfdf839270b3c9be013ec4b51ef8fdc1fe80636 commit 8bfdf839270b3c9be013ec4b51ef8fdc1fe80636 Author: Dmitry Chagin AuthorDate: 2023-05-26 16:35:08 +0000 Commit: Dmitry Chagin CommitDate: 2023-06-29 08:16:00 +0000 kdump: Add a facility to print numbers in decimal format always To help grepping kdump output by pid or tid it makes sence to print some numbers in decimal format always. Eg, process or thread identifier at least, as they already printed in decimal format. Switch to print pid/tid arguments of some Linux signal related syscalls in decimal format. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D40099 MFC after: 1 week (cherry picked from commit c2c9ac88c2bb62423ae91beeee4083b596922adc) --- usr.bin/kdump/kdump.h | 13 +++++++++---- usr.bin/kdump/linux.c | 12 ++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/usr.bin/kdump/kdump.h b/usr.bin/kdump/kdump.h index f5b9b85f9779..1d3e9be2b6e0 100644 --- a/usr.bin/kdump/kdump.h +++ b/usr.bin/kdump/kdump.h @@ -34,7 +34,7 @@ extern bool decimal, fancy, resolv; -#define print_number64(first,i,n,c) do { \ +#define _print_number64(first,i,n,c,d) do { \ uint64_t __v; \ \ if (quad_align && (((ptrdiff_t)((i) - (first))) & 1) == 1) { \ @@ -46,7 +46,7 @@ extern bool decimal, fancy, resolv; ((uint64_t)(uint32_t)(i)[1]) << 32; \ else \ __v = (uint64_t)*(i); \ - if (decimal) \ + if (d) \ printf("%c%jd", (c), (intmax_t)__v); \ else \ printf("%c%#jx", (c), (uintmax_t)__v); \ @@ -55,8 +55,8 @@ extern bool decimal, fancy, resolv; (c) = ','; \ } while (0) -#define print_number(i,n,c) do { \ - if (decimal) \ +#define _print_number(i,n,c,d) do { \ + if (d) \ printf("%c%jd", c, (intmax_t)*i); \ else \ printf("%c%#jx", c, (uintmax_t)(u_register_t)*i); \ @@ -65,6 +65,11 @@ extern bool decimal, fancy, resolv; c = ','; \ } while (0) +#define print_number(i,n,c) _print_number(i,n,c,decimal) +#define print_decimal_number(i,n,c) _print_number(i,n,c,true) +#define print_number64(first,i,n,c) _print_number64(first,i,n,c,decimal) +#define print_decimal_number64(first,i,n,c) _print_number64(first,i,n,c,true) + void decode_filemode(int value); void print_integer_arg(const char *(*decoder)(int), int value); void print_integer_arg_valid(const char *(*decoder)(int), int value); diff --git a/usr.bin/kdump/linux.c b/usr.bin/kdump/linux.c index 57f89f9e2faf..df400f554c23 100644 --- a/usr.bin/kdump/linux.c +++ b/usr.bin/kdump/linux.c @@ -202,7 +202,7 @@ ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip, case LINUX_SYS_linux_kill: case LINUX_SYS_linux_tkill: case LINUX_SYS_linux_rt_sigqueueinfo: - print_number(ip, narg, c); + print_decimal_number(ip, narg, c); putchar(','); print_linux_signal(*ip); ip++; @@ -210,8 +210,8 @@ ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip, break; case LINUX_SYS_linux_tgkill: case LINUX_SYS_linux_rt_tgsigqueueinfo: - print_number(ip, narg, c); - print_number(ip, narg, c); + print_decimal_number(ip, narg, c); + print_decimal_number(ip, narg, c); putchar(','); print_linux_signal(*ip); ip++; @@ -411,7 +411,7 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip, case LINUX32_SYS_linux_kill: case LINUX32_SYS_linux_tkill: case LINUX32_SYS_linux_rt_sigqueueinfo: - print_number(ip, narg, c); + print_decimal_number(ip, narg, c); putchar(','); print_linux_signal(*ip); ip++; @@ -419,8 +419,8 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip, break; case LINUX32_SYS_linux_tgkill: case LINUX32_SYS_linux_rt_tgsigqueueinfo: - print_number(ip, narg, c); - print_number(ip, narg, c); + print_decimal_number(ip, narg, c); + print_decimal_number(ip, narg, c); putchar(','); print_linux_signal(*ip); ip++;