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

Fix analysis cpu usage #4909

Merged
merged 3 commits into from
Feb 16, 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
6 changes: 3 additions & 3 deletions librz/arch/dwarf_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ static const char *map_dwarf_reg_to_riscv_reg(ut32 reg_num) {
* \param bits The architecture bitness
* \return The function that maps a DWARF register number to a register name
*/
static DWARF_RegisterMapping dwarf_register_mapping_query(RZ_NONNULL char *arch, int bits) {
static DWARF_RegisterMapping dwarf_register_mapping_query(RZ_NONNULL const char *arch, int bits) {
if (RZ_STR_EQ(arch, "x86")) {
if (bits == 64) {
return map_dwarf_reg_to_x86_64_reg;
Expand Down Expand Up @@ -1759,10 +1759,10 @@ RZ_API void rz_analysis_dwarf_preprocess_info(
RZ_NONNULL RZ_BORROW RzAnalysis *analysis,
RZ_NONNULL RZ_BORROW RzBinDWARF *dw) {
rz_return_if_fail(analysis && dw);
if (!dw->info) {
if (!dw->info || !analysis->cur) {
return;
}
analysis->debug_info->dwarf_register_mapping = dwarf_register_mapping_query(analysis->cpu, analysis->bits);
analysis->debug_info->dwarf_register_mapping = dwarf_register_mapping_query(analysis->cur->name, analysis->bits);
DwContext ctx = {
.analysis = analysis,
.dw = dw,
Expand Down
2 changes: 1 addition & 1 deletion librz/arch/p/asm/asm_arm_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ char **arm_cpu_descriptions() {
RzAsmPlugin rz_asm_plugin_arm_cs = {
.name = "arm",
.desc = "Capstone ARM disassembler",
.cpus = "v8,cortexm,arm1176,cortexA72,cortexA8",
.cpus = "arm,v8,cortexm,arm1176,cortexA72,cortexA8",
.platforms = "bcm2835,omap3430",
.features = "v8",
.license = "BSD",
Expand Down
2 changes: 2 additions & 0 deletions librz/core/cconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ static bool cb_asmarch(void *user, void *data) {
if (core->analysis) {
const char *asmcpu = rz_config_get(core->config, "asm.cpu");
const char *platform = rz_config_get(core->config, "asm.platform");
rz_config_set(core->config, "analysis.cpu", asmcpu);
rz_syscall_setup(core->analysis->syscall, node->value, core->analysis->bits, asmcpu, asmos);
update_syscall_ns(core);
char *platforms_dir = rz_path_system(RZ_SDB_ARCH_PLATFORMS);
Expand Down Expand Up @@ -680,6 +681,7 @@ static bool cb_asmbits(void *user, void *data) {
const char *asmarch = rz_config_get(core->config, "asm.arch");
const char *asmcpu = rz_config_get(core->config, "asm.cpu");
if (core->analysis) {
rz_config_set(core->config, "analysis.cpu", asmcpu);
if (!rz_syscall_setup(core->analysis->syscall, asmarch, bits, asmcpu, asmos)) {
// eprintf ("asm.arch: Cannot setup syscall '%s/%s' from '%s'\n",
// node->value, asmos, RZ_LIBDIR"/rizin/"RZ_VERSION"/syscall");
Expand Down
Loading