Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add xtensa dwarf register mapping #4878

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions librz/arch/dwarf_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ static const char *map_dwarf_reg_to_riscv_reg(ut32 reg_num) {
#include <sh/sh_dwarf_regnum_table.h>
#include <tricore/tricore_dwarf_regnum_table.h>
#include <x86/x86_dwarf_regnum_table.h>
#include <xtensa/xtensa_dwarf_regnum_table.h>

/**
* \brief Returns a function that maps a DWARF register number to a register name
Expand Down Expand Up @@ -547,6 +548,9 @@ static DWARF_RegisterMapping dwarf_register_mapping_query(RZ_NONNULL char *arch,
if (RZ_STR_EQ(arch, "rx")) {
return map_dwarf_reg_to_rx_reg;
}
if (RZ_STR_EQ(arch, "xtensa")) {
return xtensa_register_name;
}
RZ_LOG_ERROR("No DWARF register mapping function defined for %s %d bits\n", arch, bits);
return map_dwarf_register_dummy;
}
Expand Down
23 changes: 23 additions & 0 deletions librz/arch/isa/xtensa/xtensa_dwarf_regnum_table.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: 2025 Billow <[email protected]>
// SPDX-License-Identifier: LGPL-3.0-only

#ifndef XTENSA_DWARF_REGNUM_TABLE_H
#define XTENSA_DWARF_REGNUM_TABLE_H

static const char *
xtensa_register_name(ut32 index) {
static const char *const reg_names[] = {
"a0", "sp", "a2", "a3", "a4", "a5", "a6", "a7",
"a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15",
"fp", "argp", "b0",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
"acc"
};
if (index >= RZ_ARRAY_SIZE(reg_names)) {
return NULL;
}
return reg_names[index];
}

#endif // XTENSA_DWARF_REGNUM_TABLE_H
Loading