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

Quick Rename/Automatic Renaming similar to IDA #2967

Open
agnosticlines opened this issue Feb 15, 2022 · 1 comment
Open

Quick Rename/Automatic Renaming similar to IDA #2967

agnosticlines opened this issue Feb 15, 2022 · 1 comment
Labels
Component: Core Issue needs changes to the core Effort: Medium Issue should take < 1 month Impact: High Issue adds or blocks important functionality Type: Enhancement Issue is a small enhancement to existing functionality

Comments

@agnosticlines
Copy link

agnosticlines commented Feb 15, 2022

What is the feature you'd like to have?
IDA added a feature in 7.6 that automatically names variables according to some rules, this can massively speed up time renaming every copy of a variable.

Here are the rules from the blog article (https://hex-rays.com/blog/igors-tip-of-the-week-76-quick-rename/):

  • by name of the opposite variable in assignments: v1 = myvar: rename v1 -> myvar1
  • by name of the opposite variable in comparisons: offset < v1: rename v1 -> offset1
  • as pointer to a well-named variable: v1 = &Value: rename v1 -> p_Value
  • by structure field in expressions: v1 = x.Next: rename v1 -> Next
  • as pointer to a structure field: v1 = &x.left: rename v1 -> p_left
  • by name of formal argument in a call: close(v1): rename v1 -> fd
  • by name of a called function: v1=create_table(): rename v1 -> table
  • by return type of called function: v1 = strchr(s, '1'): rename v1 -> str
  • by a string constant: v1 = fopen("/etc/fstab", "r"): rename v1 -> etc_fstab
  • by variable type: error_t v1: rename v1 -> error
  • standard name for the result variable: return v1: rename v1 -> ok if current function returns bool

Some additional ones that would be interesting is for functions where there's no control flow divergence and only a single function call (sprintf for example), they could be auto renamed to sprintf_wrapper or similar.

Some of these are probably a bit too much like Igor/Ilfaks personal choice such as the create_table one, but being able to automatically rename things would be extremely useful, ideally each rule would have options to enable/disable it, I'd say it could be a workflow thing but it seems to be more useful during manual interaction and renaming of objects/variables.

Tagging @psifertex because I mentioned I would make an issue to track this

@agnosticlines agnosticlines added the Type: Enhancement Issue is a small enhancement to existing functionality label Feb 15, 2022
@plafosse plafosse added Effort: Medium Issue should take < 1 month Impact: High Issue adds or blocks important functionality labels Feb 21, 2022
@xusheng6
Copy link
Member

Related to #2558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Issue needs changes to the core Effort: Medium Issue should take < 1 month Impact: High Issue adds or blocks important functionality Type: Enhancement Issue is a small enhancement to existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants