From: Aditya Vidyadhar Kamath <akamath996@gmail.com>
To: ulrich.weigand@de.ibm.com, simon.marchi@polymtl.ca, tom@tromey.com
Cc: gdb-patches@sourceware.org, Aditya.Kamath1@ibm.com,
sangamesh.swamy@in.ibm.com,
Aditya Vidyadhar Kamath <aditya.kamath1@ibm.com>
Subject: [PATCH v4 1/4] Fix styles in aix-thread.c to follow GNU style code.
Date: Mon, 5 Oct 2026 17:14:36 +0530 [thread overview]
Message-ID: <20261005114435.31454-2-akamath996@gmail.com> (raw)
From: Aditya Vidyadhar Kamath <aditya.kamath1@ibm.com>
https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards
As per GDB code guidelines making minor changes to follow before
cleaning up aix-thread.c legacy code.
The following things were done:
1: 80 length column maintained now.
2: Some functions changed from function() to function ()
3: Switch case also changed [only style] to follow the guideline.
---
gdb/aix-thread.c | 91 ++++++++++++++++++++++++++----------------------
1 file changed, 49 insertions(+), 42 deletions(-)
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 647ed063671..65b9c5f7479 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -299,16 +299,16 @@ ptrace_check (int req, int id, int ret)
req, id, ret, errno);
return ret == -1 ? 0 : 1;
}
- break;
- case PTT_READ_VEC:
- case PTT_READ_VSX:
- if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- "ptrace (%d, %d) = %d (errno = %d)\n",
- req, id, ret, errno);
- if (ret == -1)
- return -1;
- break;
+ break;
+ case PTT_READ_VEC:
+ case PTT_READ_VSX:
+ if (debug_aix_thread)
+ gdb_printf (gdb_stdlog,
+ "ptrace (%d, %d) = %d (errno = %d)\n",
+ req, id, ret, errno);
+ if (ret == -1)
+ return -1;
+ break;
}
error (_("aix-thread: ptrace (%d, %d) returned %d (errno = %d %s)"),
req, id, ret, errno, safe_strerror (errno));
@@ -368,7 +368,8 @@ pid_to_prc (ptid_t *ptidp)
the address of SYMBOLS[<i>].name. */
static int
-pdc_symbol_addrs (pthdb_user_t user_current_pid, pthdb_symbol_t *symbols, int count)
+pdc_symbol_addrs (pthdb_user_t user_current_pid, pthdb_symbol_t *symbols,
+ int count)
{
int i;
char *name;
@@ -447,13 +448,13 @@ pdc_read_regs (pthdb_user_t user_current_pid,
if (!ptrace64aix (PTT_READ_GPRS, tid,
(unsigned long) gprs64, 0, NULL))
memset (gprs64, 0, sizeof (gprs64));
- memcpy (context->gpr, gprs64, sizeof(gprs64));
+ memcpy (context->gpr, gprs64, sizeof (gprs64));
}
else
{
if (!ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL))
memset (gprs32, 0, sizeof (gprs32));
- memcpy (context->gpr, gprs32, sizeof(gprs32));
+ memcpy (context->gpr, gprs32, sizeof (gprs32));
}
}
@@ -462,7 +463,7 @@ pdc_read_regs (pthdb_user_t user_current_pid,
{
if (!ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
memset (fprs, 0, sizeof (fprs));
- memcpy (context->fpr, fprs, sizeof(fprs));
+ memcpy (context->fpr, fprs, sizeof (fprs));
}
/* Special-purpose registers. */
@@ -473,49 +474,49 @@ pdc_read_regs (pthdb_user_t user_current_pid,
if (!ptrace64aix (PTT_READ_SPRS, tid,
(unsigned long) &sprs64, 0, NULL))
memset (&sprs64, 0, sizeof (sprs64));
- memcpy (&context->msr, &sprs64, sizeof(sprs64));
+ memcpy (&context->msr, &sprs64, sizeof (sprs64));
}
else
{
if (!ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
memset (&sprs32, 0, sizeof (sprs32));
- memcpy (&context->msr, &sprs32, sizeof(sprs32));
+ memcpy (&context->msr, &sprs32, sizeof (sprs32));
}
}
/* vector registers. */
__vmx_context_t vmx;
- if (__power_vmx() && (flags & PTHDB_FLAG_REGS))
+ if (__power_vmx () && (flags & PTHDB_FLAG_REGS))
{
if (data->arch64)
{
if (!ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0))
memset (&vmx, 0, sizeof (vmx));
- memcpy (&context->vmx, &vmx, sizeof(__vmx_context_t));
+ memcpy (&context->vmx, &vmx, sizeof (__vmx_context_t));
}
else
{
if (!ptrace32 (PTT_READ_VEC, tid, (long long) &vmx, 0, 0))
memset (&vmx, 0, sizeof (vmx));
- memcpy (&context->vmx, &vmx, sizeof(__vmx_context_t));
+ memcpy (&context->vmx, &vmx, sizeof (__vmx_context_t));
}
}
/* vsx registers. */
__vsx_context_t vsx;
- if (__power_vsx() && (flags & PTHDB_FLAG_REGS))
+ if (__power_vsx () && (flags & PTHDB_FLAG_REGS))
{
if (data->arch64)
{
if (!ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0))
memset (&vsx, 0, sizeof (vsx));
- memcpy (&context->vsx, &vsx, sizeof(__vsx_context_t));
+ memcpy (&context->vsx, &vsx, sizeof (__vsx_context_t));
}
else
{
if (!ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0))
memset (&vsx, 0, sizeof (vsx));
- memcpy (&context->vsx, &vsx, sizeof(__vsx_context_t));
+ memcpy (&context->vsx, &vsx, sizeof (__vsx_context_t));
}
}
return 0;
@@ -576,7 +577,7 @@ pdc_write_regs (pthdb_user_t user_current_pid,
}
/* vector registers. */
- if (__power_vmx() && (flags & PTHDB_FLAG_REGS))
+ if (__power_vmx () && (flags & PTHDB_FLAG_REGS))
{
if (data->arch64)
ptrace64aix (PTT_WRITE_VEC, tid, (unsigned long) &context->vmx, 0, 0);
@@ -585,7 +586,7 @@ pdc_write_regs (pthdb_user_t user_current_pid,
}
/* vsx registers. */
- if (__power_vsx() && (flags & PTHDB_FLAG_REGS))
+ if (__power_vsx () && (flags & PTHDB_FLAG_REGS))
{
if (data->arch64)
ptrace64aix (PTT_WRITE_VSX, tid, (unsigned long) &context->vsx, 0, 0);
@@ -636,7 +637,8 @@ pdc_write_data (pthdb_user_t user_current_pid, void *buf,
if (debug_aix_thread)
gdb_printf (gdb_stdlog,
- "pdc_write_data (user_current_pid = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
+ "pdc_write_data (user_current_pid = %ld, buf = 0x%lx,"
+ " addr = %s, len = %ld)\n",
user_current_pid, (long) buf, hex_string (addr), len);
{
@@ -682,7 +684,8 @@ pdc_realloc (pthdb_user_t user_current_pid, void *buf, size_t len, void **bufp)
{
if (debug_aix_thread)
gdb_printf (gdb_stdlog,
- "pdc_realloc (user_current_pid = %ld, buf = 0x%lx, len = %ld, bufp = 0x%lx)\n",
+ "pdc_realloc (user_current_pid = %ld, buf = 0x%lx,"
+ " len = %ld, bufp = 0x%lx)\n",
user_current_pid, (long) buf, len, (long) bufp);
*bufp = xrealloc (buf, len);
if (debug_aix_thread)
@@ -1268,7 +1271,8 @@ supply_sprs32 (struct regcache *regcache,
function. */
static void
-fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid)
+fetch_regs_user_thread (struct regcache *regcache,
+ pthdb_pthread_t pdtid)
{
struct gdbarch *gdbarch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -1381,7 +1385,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
else
ret = ptrace32 (PTT_READ_VEC, tid, (uintptr_t) &vmx, 0, 0);
if (ret < 0)
- memset(&vmx, 0, sizeof(__vmx_context_t));
+ memset (&vmx, 0, sizeof (__vmx_context_t));
for (i = 0; i < ppc_num_vrs; i++)
regcache->raw_supply (tdep->ppc_vr0_regnum + i, &(vmx.__vr[i]));
regcache->raw_supply (tdep->ppc_vrsave_regnum, &(vmx.__vrsave));
@@ -1398,7 +1402,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
else
ret = ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
if (ret < 0)
- memset(&vsx, 0, sizeof(__vsx_context_t));
+ memset (&vsx, 0, sizeof (__vsx_context_t));
for (i = 0; i < ppc_num_vshrs; i++)
regcache->raw_supply (tdep->ppc_vsr0_upper_regnum + i, &(vsx.__vsr_dw1[i]));
}
@@ -1461,7 +1465,7 @@ aix_thread_target::fetch_registers (struct regcache *regcache, int regno)
{
thread = current_inferior ()->find_thread (regcache->ptid ());
aix_thread_info *priv = get_aix_thread_info (thread);
- tid = regcache->ptid().lwp ();
+ tid = regcache->ptid ().lwp ();
if (tid == PTHDB_INVALID_TID)
fetch_regs_user_thread (regcache, priv->pdtid);
@@ -1480,9 +1484,10 @@ fill_altivec (const struct regcache *regcache, __vmx_context_t *vmx)
int regno;
for (regno = 0; regno < ppc_num_vrs; regno++)
- if (REG_VALID == regcache->get_register_status (tdep->ppc_vr0_regnum + regno))
+ if (REG_VALID == regcache->get_register_status
+ (tdep->ppc_vr0_regnum + regno))
regcache->raw_collect (tdep->ppc_vr0_regnum + regno,
- &(vmx->__vr[regno]));
+ &(vmx->__vr[regno]));
if (REG_VALID == regcache->get_register_status (tdep->ppc_vrsave_regnum))
regcache->raw_collect (tdep->ppc_vrsave_regnum, &(vmx->__vrsave));
@@ -1500,7 +1505,8 @@ fill_vsx (const struct regcache *regcache, __vsx_context_t *vsx)
int regno;
for (regno = 0; regno < ppc_num_vshrs; regno++)
- if (REG_VALID == regcache->get_register_status ( tdep->ppc_vsr0_upper_regnum + regno))
+ if (REG_VALID == regcache->get_register_status
+ (tdep->ppc_vsr0_upper_regnum + regno))
regcache->raw_collect (tdep->ppc_vsr0_upper_regnum + regno,
&(vsx->__vsr_dw1[0]) + regno);
}
@@ -1630,7 +1636,8 @@ fill_sprs32 (const struct regcache *regcache,
but I doubt it's worth the effort. */
static void
-store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
+store_regs_user_thread (const struct regcache *regcache,
+ pthdb_pthread_t pdtid)
{
struct gdbarch *gdbarch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -1656,9 +1663,9 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
/* Fill altivec-registers. */
- if (__power_vmx())
+ if (__power_vmx ())
{
- memset(&vmx, 0, sizeof(__vmx_context_t));
+ memset (&vmx, 0, sizeof (__vmx_context_t));
for (i = 0; i < ppc_num_vrs; i++)
if (REG_VALID == regcache->get_register_status (tdep->ppc_vr0_regnum + i))
{
@@ -1674,9 +1681,9 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
/* Fill vsx registers. */
- if (__power_vsx())
+ if (__power_vsx ())
{
- memset(&vsx, 0, sizeof(__vsx_context_t));
+ memset (&vsx, 0, sizeof (__vsx_context_t));
for (i = 0; i < ppc_num_vshrs; i++)
if (REG_VALID == regcache->get_register_status (tdep->ppc_vsr0_regnum + i))
{
@@ -1866,7 +1873,7 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
&& regno <= tdep->ppc_vrsave_regnum)))
{
__vmx_context_t vmx;
- if (__power_vmx())
+ if (__power_vmx ())
{
if (data->arch64)
ret = ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
@@ -1874,7 +1881,7 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
ret = ptrace32 (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
if (ret > 0)
{
- fill_altivec(regcache, &vmx);
+ fill_altivec (regcache, &vmx);
if (data->arch64)
ret = ptrace64aix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0);
else
@@ -1887,11 +1894,11 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
/* VSX registers. */
if (tdep->ppc_vsr0_upper_regnum != -1 && (regno == -1
- || (regno >=tdep->ppc_vsr0_upper_regnum
+ || (regno >= tdep->ppc_vsr0_upper_regnum
&& regno < tdep->ppc_vsr0_upper_regnum + ppc_num_vshrs)))
{
__vsx_context_t vsx;
- if (__power_vsx())
+ if (__power_vsx ())
{
if (data->arch64)
ret = ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
--
2.51.2
next reply other threads:[~2026-10-05 11:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 11:44 Aditya Vidyadhar Kamath [this message]
2026-10-05 14:06 ` Simon Marchi
2026-10-05 17:16 ` Aditya Kamath
2026-10-05 17:28 ` Aditya Kamath
2026-10-05 17:35 ` Simon Marchi
2026-10-05 14:19 ` Simon Marchi
2026-10-05 18:54 ` Aditya Kamath
2026-10-05 20:06 ` Simon Marchi
2026-10-06 13:23 ` Aditya Kamath
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=20261005114435.31454-2-akamath996@gmail.com \
--to=akamath996@gmail.com \
--cc=Aditya.Kamath1@ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=sangamesh.swamy@in.ibm.com \
--cc=simon.marchi@polymtl.ca \
--cc=tom@tromey.com \
--cc=ulrich.weigand@de.ibm.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