Skip to content

Need a way to set type metadata on global variables #78

Description

@laanwj

According to Opus 4.7:

->

can you actually change the type of variables in the metadata? eg try to make tof_timing_budget_table float tof_timing_budget_table[5]

<-

Short answer: no — not for global data symbols, with the tools this MCP server exposes. The retyping tools here are retype_variable / set_local_variable_type, which only apply to function-local variables, and set_function_prototype for functions. For data labels I only have rename_data (name), set_comment, and declare_c_type/define_types (create a type in the library, but no endpoint to bind that type to an address). There's no "set data type at address" call available — that's why the correction tables only got typed when you did it in the BN UI.

According to the README here's get_data_decl:

| `get_data_decl(name_or_address, length)`                             | Return a C-like declaration and a hexdump for a data symbol or address.                                      |

But no associated setter. Closest is rename_data, but that seems to be strictly about the name.

From what i understand from the binja API this would require use of define_user_data_var

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions