From 488ded0c8d9e43deef531ad174937982b41f8e4b Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 24 Apr 2019 17:08:18 -0700 Subject: [PATCH] arm: Fix some style issues in stacktrace.cc. De-indent the ArmISA namespace, and wrap some overly long lines. Change-Id: Idc02b025bdfda483ddbd27d662e2314a5cbcb23c Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18370 Tested-by: kokoro Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/arch/arm/stacktrace.cc | 214 +++++++++++++++++++------------------ 1 file changed, 112 insertions(+), 102 deletions(-) diff --git a/src/arch/arm/stacktrace.cc b/src/arch/arm/stacktrace.cc index a7e26c618..0033876a0 100644 --- a/src/arch/arm/stacktrace.cc +++ b/src/arch/arm/stacktrace.cc @@ -41,138 +41,148 @@ #include "mem/fs_translating_port_proxy.hh" #include "sim/system.hh" -using namespace std; namespace ArmISA { - ProcessInfo::ProcessInfo(ThreadContext *_tc) - : tc(_tc) - { - Addr addr = 0; - FSTranslatingPortProxy &vp = tc->getVirtProxy(); +ProcessInfo::ProcessInfo(ThreadContext *_tc) + : tc(_tc) +{ + Addr addr = 0; - if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_size", addr)) - panic("thread info not compiled into kernel\n"); - thread_info_size = vp.readGtoH(addr); + FSTranslatingPortProxy &vp = tc->getVirtProxy(); - if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_size", addr)) - panic("thread info not compiled into kernel\n"); - task_struct_size = vp.readGtoH(addr); + if (!tc->getSystemPtr()->kernelSymtab->findAddress( + "thread_info_size", addr)) { + panic("thread info not compiled into kernel\n"); + } + thread_info_size = vp.readGtoH(addr); - if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_task", addr)) - panic("thread info not compiled into kernel\n"); - task_off = vp.readGtoH(addr); + if (!tc->getSystemPtr()->kernelSymtab->findAddress( + "task_struct_size", addr)) { + panic("thread info not compiled into kernel\n"); + } + task_struct_size = vp.readGtoH(addr); - if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_pid", addr)) - panic("thread info not compiled into kernel\n"); - pid_off = vp.readGtoH(addr); + if (!tc->getSystemPtr()->kernelSymtab->findAddress( + "thread_info_task", addr)) { + panic("thread info not compiled into kernel\n"); + } + task_off = vp.readGtoH(addr); - if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr)) - panic("thread info not compiled into kernel\n"); - name_off = vp.readGtoH(addr); + if (!tc->getSystemPtr()->kernelSymtab->findAddress( + "task_struct_pid", addr)) { + panic("thread info not compiled into kernel\n"); } + pid_off = vp.readGtoH(addr); - Addr - ProcessInfo::task(Addr ksp) const - { - Addr base = ksp & ~0x1fff; - if (base == ULL(0xffffffffc0000000)) - return 0; + if (!tc->getSystemPtr()->kernelSymtab->findAddress( + "task_struct_comm", addr)) { + panic("thread info not compiled into kernel\n"); + } + name_off = vp.readGtoH(addr); +} - Addr tsk; +Addr +ProcessInfo::task(Addr ksp) const +{ + Addr base = ksp & ~0x1fff; + if (base == ULL(0xffffffffc0000000)) + return 0; - FSTranslatingPortProxy &vp = tc->getVirtProxy(); - tsk = vp.readGtoH(base + task_off); + Addr tsk; - return tsk; - } + FSTranslatingPortProxy &vp = tc->getVirtProxy(); + tsk = vp.readGtoH(base + task_off); - int - ProcessInfo::pid(Addr ksp) const - { - Addr task = this->task(ksp); - if (!task) - return -1; + return tsk; +} - uint16_t pd; +int +ProcessInfo::pid(Addr ksp) const +{ + Addr task = this->task(ksp); + if (!task) + return -1; - FSTranslatingPortProxy &vp = tc->getVirtProxy(); - pd = vp.readGtoH(task + pid_off); + uint16_t pd; - return pd; - } + FSTranslatingPortProxy &vp = tc->getVirtProxy(); + pd = vp.readGtoH(task + pid_off); - string - ProcessInfo::name(Addr ksp) const - { - Addr task = this->task(ksp); - if (!task) - return "unknown"; + return pd; +} - char comm[256]; - CopyStringOut(tc, comm, task + name_off, sizeof(comm)); - if (!comm[0]) - return "startup"; +std::string +ProcessInfo::name(Addr ksp) const +{ + Addr task = this->task(ksp); + if (!task) + return "unknown"; - return comm; - } + char comm[256]; + CopyStringOut(tc, comm, task + name_off, sizeof(comm)); + if (!comm[0]) + return "startup"; - StackTrace::StackTrace() - : tc(0), stack(64) - { - } + return comm; +} - StackTrace::StackTrace(ThreadContext *_tc, const StaticInstPtr &inst) - : tc(0), stack(64) - { - trace(_tc, inst); - } +StackTrace::StackTrace() + : tc(0), stack(64) +{ +} - StackTrace::~StackTrace() - { - } +StackTrace::StackTrace(ThreadContext *_tc, const StaticInstPtr &inst) + : tc(0), stack(64) +{ + trace(_tc, inst); +} - void - StackTrace::trace(ThreadContext *_tc, bool is_call) - { - } +StackTrace::~StackTrace() +{ +} - bool - StackTrace::isEntry(Addr addr) - { - return false; - } +void +StackTrace::trace(ThreadContext *_tc, bool is_call) +{ +} - bool - StackTrace::decodeStack(MachInst inst, int &disp) - { - return false; - } +bool +StackTrace::isEntry(Addr addr) +{ + return false; +} - bool - StackTrace::decodeSave(MachInst inst, int ®, int &disp) - { - return false; - } +bool +StackTrace::decodeStack(MachInst inst, int &disp) +{ + return false; +} - /* - * Decode the function prologue for the function we're in, and note - * which registers are stored where, and how large the stack frame is. - */ - bool - StackTrace::decodePrologue(Addr sp, Addr callpc, Addr func, - int &size, Addr &ra) - { - return false; - } +bool +StackTrace::decodeSave(MachInst inst, int ®, int &disp) +{ + return false; +} + +/* + * Decode the function prologue for the function we're in, and note + * which registers are stored where, and how large the stack frame is. + */ +bool +StackTrace::decodePrologue(Addr sp, Addr callpc, Addr func, + int &size, Addr &ra) +{ + return false; +} #if TRACING_ON - void - StackTrace::dump() - { - DPRINTFN("------ Stack ------\n"); +void +StackTrace::dump() +{ + DPRINTFN("------ Stack ------\n"); - DPRINTFN(" Not implemented\n"); - } + DPRINTFN(" Not implemented\n"); +} #endif } -- 2.30.2