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

Namespace not created in Symbol Tree #7260

Open
mumbel opened this issue Dec 6, 2024 · 5 comments
Open

Namespace not created in Symbol Tree #7260

mumbel opened this issue Dec 6, 2024 · 5 comments
Assignees
Labels

Comments

@mumbel
Copy link
Contributor

mumbel commented Dec 6, 2024

Describe the bug
When labeling a global data or function with a new namespace, the namespace is not added to the Symbol Tree.

Not 100% on repro yet, it's not happening for everything.

Working in a program called "foo"
Example class strings are like: "foo::bar::baz::Thing1"

DTM would then be "foo/foo/bar/baz/Thing1" for the resulting class struct

"foo::bar::baz" namespace exists with class "Thing0"
If I label the vftable "foo::bar::baz::Thing1::vftable" it doesn't generate any new symbol tree entries for "Thing1" or "Thing1/vftable"

If I, from that vftable, label "foo::bar::baz::Thing1::FUN_aabbccdd", it is also not in the symbol tree anywhere, even though the decompiler/listing/Functions/Symbol Table windows all agree the namespace is there for the function

Exiting code browser does seem to trigger it to appear.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Attachments
If applicable, please attach any files that caused problems or log files generated by the software.

Environment (please complete the following information):

  • OS: win10
  • Java Version: 21.0.4
  • Ghidra Version: 11.2
  • Ghidra Origin: official GitHub distro

Additional context
Add any other context about the problem here.

@ghidra1
Copy link
Collaborator

ghidra1 commented Dec 9, 2024

Setting a label via the API and GUI text entry will not split-apart the namespace names. This is because the ':' char is permitted in the name of a symbol. Using the GUI, you would need to 1) create the appropriate namespace/class first, 2) create a label in the global namespace at the desired address, then 3) re-parent the symbol from the symbol tree. I have never been a fan of this behavior.

The GUI dialogs should probably provide better support for selecting any defined namespace or class. May also need an action/dialog for creating a namespace or class which could also be invoked while creating/editing a label or function.

@ghidra1 ghidra1 removed their assignment Dec 9, 2024
@ghidra1 ghidra1 added Status: Prioritize This is currently being prioritized and removed Status: Triage Information is being gathered labels Dec 9, 2024
@ryanmkurtz ryanmkurtz added Status: Internal This is being tracked internally by the Ghidra team and removed Status: Prioritize This is currently being prioritized labels Dec 12, 2024
@mumbel
Copy link
Contributor Author

mumbel commented Dec 12, 2024

It is a namespace. Every window except symbol table agrees it's a namespace and treats it as such (ie namespace/name columns parse it, namespaced functions truncate symbol namespaces in decompiler). Symbol table does after closing/reopening that window or codebrowser

@ghidragon
Copy link
Collaborator

Oh, I think you are right. I was confused by what ghidra1 said, which I believe is wrong also.

@dragonmacher
Copy link
Collaborator

What should be working is updating labels via the Add Label or Edit Label... action in the Listing. If you add namespace info, Ghidra will create it and the Symbol Tree should be updated. For example, if you edit a label foo to be Parent::foo, Ghidra will create the namespace Parent, place foo in that namespace and the Symbol Tree will be updated to show Parent under the Namespaces node. I just verified this is working for the happy path case I tried.

When labeling a global data or function with a new namespace, the namespace is not added to the Symbol Tree.

How are you creating your lablels?

@dragonmacher dragonmacher added Status: Waiting on customer Waiting for customer feedback and removed Status: Internal This is being tracked internally by the Ghidra team labels Dec 12, 2024
@mumbel
Copy link
Contributor Author

mumbel commented Dec 12, 2024

Listing window, keyboard shortcut to label l.

Yeah, I'm not sure the reasoning why it takes a "refresh" of the symbol tree window for it to appear, but every other window seems happy. Maybe it's a depth issue, my example names are changed but otherwise similar structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants