On 2023/11/08 10:39, Ming Wang wrote:
Changes between v1 and v2:
- Simplified the LoongArch64 gdb's backport patch and appended it to the
gdb-10.2.patch.
- Add building the loongarch crash binary on an X86 64 host support.
- Fix offset_table format issues.
- Move private definitions code to loongarch64.c.
The following compilation warnings are observed with the patch set,
could you fix them?
# make target=LOONGARCH64
...
cc -c -g -DLOONGARCH64 -DGDB_10_2 loongarch64.c -Wall -O2 -Wstrict-prototypes
-Wmissing-prototypes -fstack-protector -Wformat-security
loongarch64.c: In function 'loongarch64_analyze_function':
loongarch64.c:557:11: warning: unused variable 'reg' [-Wunused-variable]
ulong i, reg;
^~~
loongarch64.c: In function 'loongarch64_dump_exception_stack':
loongarch64.c:683:2: warning: 'regs' is used uninitialized in this function
[-Wuninitialized]
value_to_symstr(regs->csr_epc, buf, 16);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
loongarch64.c: In function 'loongarch64_get_stack_frame':
loongarch64.c:813:18: warning: array subscript 32 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
epc = regs->regs[LOONGARCH64_EF_CSR_EPC];
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
loongarch64.c: In function 'loongarch64_back_trace_cmd':
loongarch64.c:517:28: warning: 'regs' may be used uninitialized in this function
[-Wmaybe-uninitialized]
previous.sp = regs->regs[LOONGARCH64_EF_SP];
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
loongarch64.c: In function 'loongarch64_display_regs_from_elf_notes':
loongarch64.c:1294:51: warning: array subscript 32 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
if (!regs->regs[LOONGARCH64_EF_SP] &&
!regs->regs[LOONGARCH64_EF_CSR_EPC]) {
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
loongarch64.c:1299:2: warning: array subscript 36 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
fprintf(ofp,
^~~~~~~~~~~~
" R0: %016lx R1: %016lx R2: %016lx\n"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
" R3: %016lx R4: %016lx R5: %016lx\n"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
" R6: %016lx R7: %016lx R8: %016lx\n"
...
regs->regs[LOONGARCH64_EF_CSR_ECFG],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
regs->regs[LOONGARCH64_EF_CSR_ESTAT],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
regs->regs[LOONGARCH64_EF_CSR_EUEN]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
loongarch64.c:1299:2: warning: array subscript 38 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
loongarch64.c:1299:2: warning: array subscript 37 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
loongarch64.c:1299:2: warning: array subscript 35 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
loongarch64.c:1299:2: warning: array subscript 34 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
loongarch64.c:1299:2: warning: array subscript 33 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
loongarch64.c:1299:2: warning: array subscript 32 is above array bounds of 'long
unsigned int[32]' [-Warray-bounds]
otherwise, looks fine to me.
Thanks,
Kazu
>
>
> This patch set are for Crash-utility tool, it make crash tool support on
> loongarch64 architecture and the common commands(bt, p, rd, mod, log, set,
> dis, and so on).
>
> The patch sets were tested on a loongArch64 Loongson-3C5000 processor. Can
> successfully enter the crash command line and support for common command.
>
> ...
> KERNEL: vmlinux
> DUMPFILE: /proc/kcore
> CPUS: 16
> DATE: Thu Jul 27 19:51:21 CST 2023
> UPTIME: 06:35:11
> LOAD AVERAGE: 0.15, 0.03, 0.01
> TASKS: 257
> NODENAME: localhost.localdomain
> RELEASE: 5.10.0-60.102.0.128.oe2203.loongarch64
> VERSION: #1 SMP Fri Jul 14 04:17:09 UTC 2023
> MACHINE: loongarch64 (2200 Mhz)
> MEMORY: 64 GB
> PID: 2964
> COMMAND: "crash"
> TASK: 9000000098805500 [THREAD_INFO: 9000000094d48000]
> CPU: 6
> STATE: TASK_RUNNING (ACTIVE)
> crash>
> crash> dis -l start_kernel
> /linux-loongarch64/init/main.c: 883
> 0x9000000001030818 <start_kernel>: 0x0141ee40
> /linux-loongarch64/init/main.c: 879
> 0x900000000103081c <start_kernel+4>: 0x90000000
> /linux-loongarch64/init/main.c: 883
> 0x9000000001030820 <start_kernel+8>: addu16i.d $zero, $t8,
8179(0x1ff3)
> /linux-loongarch64/init/main.c: 879
> ...
>
> About the LoongArch64 Architecture:
>
https://www.kernel.org/doc/html/latest/loongarch/index.html
>
>
> Thanks and regards,
> Ming
>
> Ming Wang (10):
> Add LoongArch64 framework code support
> LoongArch64: Make the crash tool successfully enter the crash command
> line
> LoongArch64: Add 'pte' command support
> LoongArch64: Add 'mach' command support
> LoongArch64: Add 'bt' command support
> LoongArch64: Add 'help -m/M' command support
> LoongArch64: Add 'help -r' command support
> LoongArch64: Add 'irq' command support
> LoongArch64: Add "--kaslr" command line option support
> LoongArch64: Add LoongArch64 architecture support information
>
> Makefile | 7 +-
> README | 4 +-
> configure.c | 39 +-
> crash.8 | 2 +-
> defs.h | 164 +-
> diskdump.c | 24 +-
> gdb-10.2.patch | 12818 ++++++++++++++++++++++++++++++++++++++++++
> help.c | 13 +-
> lkcd_vmdump_v1.h | 2 +-
> lkcd_vmdump_v2_v3.h | 5 +-
> loongarch64.c | 1366 +++++
> main.c | 3 +-
> netdump.c | 27 +-
> ramdump.c | 2 +
> symbols.c | 33 +-
> 15 files changed, 14484 insertions(+), 25 deletions(-)
> create mode 100644 loongarch64.c
>
>
> base-commit: 55a43bcefa20161c7e56ed0e309e90e941f47efc