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

Unexpected type references in cross reference widget #6326

Open
emesare opened this issue Jan 16, 2025 · 0 comments
Open

Unexpected type references in cross reference widget #6326

emesare opened this issue Jan 16, 2025 · 0 comments
Labels
Effort: Trivial Issue should take < 1 day Impact: Low Issue is a papercut or has a good, supported workaround UI: Cross References Issues with the Cross References widget UI: Filter Issues with filtering or searching UI: Types Issues with the Types widget

Comments

@emesare
Copy link
Member

emesare commented Jan 16, 2025

As a user when I select a type, I expect the cross reference widget to show references to the type. However when viewing common types like HINSTANCE on windows platforms you will see references to typedefs. Typedefs specifically mean that the underlying type is effectively duplicated for each type def.

As an example, see the following repro:

  1. Open empty view
  2. Add the following types:
typedef uint8_t MY_TYPE;

struct struct_1 __packed
{
    MY_TYPE* arg1;
    MY_TYPE* arg2;
};

struct struct_2 __packed
{
    MY_TYPE* arg1;
    MY_TYPE* arg2;
};

typedef struct struct_2 STRUCT2;
  1. Run this in the python console:
for t in bv.get_type_refs_for_type('MY_TYPE'):
	print(t)
  1. Observe that the named type reference shows up:
<type struct_1, offset 0x0, indirect>
<type struct_1, offset 0x8, indirect>
<type struct_2, offset 0x0, indirect>
<type struct_2, offset 0x8, indirect>
<type STRUCT2, offset 0x0, indirect>
<type STRUCT2, offset 0x8, indirect>

Of course this is useful for analysis, but for the user facing cross reference widget I believe we should have an option to omit type defs that really are just duplicates. Careful consideration should be done so that accesses through the type def are still visible, I am not suggesting that we make type refs through type defs invisible to the user.

@emesare emesare added Effort: Trivial Issue should take < 1 day Impact: Low Issue is a papercut or has a good, supported workaround UI: Cross References Issues with the Cross References widget UI: Filter Issues with filtering or searching UI: Types Issues with the Types widget labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort: Trivial Issue should take < 1 day Impact: Low Issue is a papercut or has a good, supported workaround UI: Cross References Issues with the Cross References widget UI: Filter Issues with filtering or searching UI: Types Issues with the Types widget
Projects
None yet
Development

No branches or pull requests

1 participant