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

Creating a Namespace does not update Symbol Tree node #7889

Open
gynt opened this issue Mar 9, 2025 · 9 comments
Open

Creating a Namespace does not update Symbol Tree node #7889

gynt opened this issue Mar 9, 2025 · 9 comments
Assignees
Labels
Status: Triage Information is being gathered

Comments

@gynt
Copy link

gynt commented Mar 9, 2025

Describe the bug
The bug occurs when using the UI or createNamespace to create a Namespace that is nested multiple levels. In order to refresh the Symbol Tree node, the root node has to be collapsed and uncollapsed.

To Reproduce
Steps to reproduce the behavior:

  1. In the Symbol Tree, collapse the root node named "Namespaces".
  2. Run the following script:
Global = getCurrentProgram().getGlobalNamespace()
BR01 = createNamespace(Global, "Bug-Report-01")
BR02 = createNamespace(Global, "Bug-Report-02")
A = createNamespace(BR01, "A")
  1. Expand node "Namespaces" and expand all the way down to Bug-Report-01 => A
  2. Right-click A and "Create Namespace" (or run createNamespace(A, "Invisible")). No new node appears but a new namespace is actually created.
  3. Collapse the root "Namespaces" node.
  4. Expand it again all the way down to A. Now observe the newly created Namespace with a default name of "NewNamespace"

Note that it only happens this deep into the Tree, it does not happen for me one higher, e.g. on the Bug-Report-01 level.
Note that it only happens if two Namespace nodes are collapsed into a "Summary" node, in this case "Bug-Report-0".
Note that it is also not updating if you move functions or other namespaces and classes into the bugged namespace.

Expected behavior
I expect the Namespace node to update in the UI.

Environment (please complete the following information):

  • OS: Windows
  • Java Version: 21.0
  • Ghidra Version: 11.3.1
  • Ghidra Origin: official GitHub distro
@mumbel
Copy link
Contributor

mumbel commented Mar 9, 2025

#7260

@gynt
Copy link
Author

gynt commented Mar 9, 2025

Oops, I did read that issue and then thought my issue is different... But I guess it is not, it may be very well the exact same issue. For me it inclines to happen more often if namespaces have a "summary" node.

@mumbel
Copy link
Contributor

mumbel commented Mar 10, 2025

Yeah, couldn't tell if it was 100% the same, just a reference for devs

@astrelsky
Copy link
Contributor

Something similar can occur when converting a namespace to a class too.

@dragonmacher dragonmacher self-assigned this Mar 10, 2025
@dragonmacher dragonmacher added the Status: Triage Information is being gathered label Mar 10, 2025
@dragonmacher
Copy link
Collaborator

dragonmacher commented Mar 13, 2025

Based on the feedback, I think there is some latent bug in the Symbol Tree updating. That being said, I cannot reproduce OP's original issue.

I'm guessing there is some sort of timing / threading issue at play. The Symbol Tree will buffer events from the system for symbol changes. At some point the events are flushed to the tree. The tree will then run all requests in a background thread. That being said, without some way to force the issue to appear, at least periodically (like a high volume script or test), then I may not be able to find the issue.

@gynt
Copy link
Author

gynt commented Mar 14, 2025

@dragonmacher My project file is very large with the amount of symbols in the 10000 range. Maybe this affects the behavior. Did you test the script on a smaller project? I have an eight core 8 GB intel i5

@dragonmacher
Copy link
Collaborator

My project was trivial. Thanks for the extra info. I'll dig some more.

@astrelsky
Copy link
Contributor

My project was trivial. Thanks for the extra info. I'll dig some more.

I see these sort of problems all the time so I find it hard to believe you are unable to reproduce.

@dragonmacher
Copy link
Collaborator

This area has changed a bit in master. There is a chance that your specific example above has been fixed. If you can try running from master, then you could see if it is fixed for you. Otherwise, the next release will have the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Information is being gathered
Projects
None yet
Development

No branches or pull requests

4 participants