3

Why is there 2 places for structures in IDA: Local Types and Structures?

What are Local Types local to?

Why do I have to synchronize a type in the Local Types window to the idb in order to edit it? Isn't it already in the database? It is certainly in the .idb database, isn't it?

When I dump typeinfo to the .idc file(File > Produce File > Dump typeinfo to IDC File...) and then import it in the same or another database, why instead of importing defined Local Types to the Local Types window and defined structures in the Structures window to the Structures, it imports everything to both places?

2 Answers 2

4

Although this is not a complete answer to your question, for some background detail, I once asked Hex-Rays via support email why there were two type systems. I don't think I'm violating any sort of important confidentiality considerations by simply copying and pasting the response here; I apologize in advance to Hex-Rays if I misjudged that:

We will try to combine these two type systems into one. However, it is not a simple task:

  • C types can not express everything that asm level types can (e.g. member comments or representation)
  • C types in general cannot be used to represent data items in the assembler listing
  • It is impossible to refer to a member of a C type by its "id"
  • asm types are used to represent stack frames; I doubt that C types can do this job nicely

These are just a few things, there are probably many other obstacles on our way. However, the idea is to combine them, or at least hide the struct/enum types from the user and let him work only with local types.

4
  • Thanks, that made it clearer. Still should've used a single type system. For example, the fact that it's impossible to refer to a member of a C type by its id is irrelevant: it's just a problem in their C-type system. There's nothing preventing them to make a single type system that supports both ways: and has the ability to refer to members of a type by id. You already can import C-type to the Structures and edit either of those 2, and the other one will update accordingly.
    – KulaGGin
    Feb 5, 2022 at 11:30
  • @KulaGGin are you sure? I think that not all types (e.g. those available from debugging symbols seem to be included there) are automatically copied over to the Structures view. For some it takes more. I think that's reflected in the "Sync" column of the "Local Types" view.
    – 0xC0000022L
    Oct 21, 2023 at 21:33
  • 1
    @0xC0000022L they're not automatically copied. But once you copy from Local Types to Structures, you can edit them either in Local Types or Structures and the other syncs.
    – KulaGGin
    Oct 22, 2023 at 19:43
  • @KulaGGin Got it, I probably misunderstood your meaning.
    – 0xC0000022L
    Oct 22, 2023 at 19:53
2

Why is there 2 places for structures in IDA: Local Types and Structures?

I randomly stumbled upon an answer in the product's help documentation: https://www.hex-rays.com/products/ida/support/idadoc/1042.shtml

Apparently, it's assembly-level and C-level types.

What are Local Types local to?

The local types are types local to the current(local) type info library, which is the main and only type info library for the database, as I understand.

Why do I have to synchronize a type in the Local Types window to the idb in order to edit it?

Well, apparently, I don't have to, and I can edit Local Types if I press right mouse button on the type and choose Edit... option.

Isn't it already in the database? It is certainly in the .idb database, isn't it?

It is.

When I dump typeinfo to the .idc file(File > Produce File > Dump typeinfo to IDC File...) and then import it in the same or another database, why instead of importing defined Local Types to the Local Types window and defined structures in the Structures window to the Structures, it imports everything to both places?

Because it's doing it wrong: it takes Structures and Local Types and creates an .idc script that imports all types as assembly-level structures, instead of doing it properly: port assembly-level structures(Structures) as assembly-level structures and port C-level structures(Local Types) as C-level strutrures.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.