question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Erroneous underscores in templates with templates

See original GitHub issue

Describe the bug Analyzing a program with debug info (both dwarf and pdb) that contains a symbol with a template containing a template will apply a symbol which does not match the symbol in the debug info. The GnuDemangler seems to be the only thing to apply it correctly. The ms demangler gets this even more wrong and adds in things like “class_” and “struct_” into the symbol name.

To Reproduce Steps to reproduce the behavior:

  1. Compile the code under attachments with optimizations disabled to prevent inlining.
  2. Go to the main function and see Holder<Holder<int>_>::Holder instead of Holder<Holder<int>>::Holder

Expected behavior There should obviously be no underscored where there were none to begin with.

Attachments

template <typename T>
class Holder {
    T t;
public:
    Holder() : t(){}
    ~Holder() = default;
    T get() const { return t; }
};

int main() {
    Holder<Holder<int>> var;
    return var.get().get();
}

Environment (please complete the following information):

  • OS: Microsoft Windows [Version 10.0.22000.556]
  • Java Version: 11
  • Ghidra Version: 10.1.2 and 10.2_DEV 21aa55cf2dd173c668ca042cf8d352fb8462394c

Additional context Sometimes a demangler will insert a space for readability. Removing it instead of replacing it with an underscore would be correct.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
astrelskycommented, Mar 16, 2022

@ryanmkurtz this also occurs with DWARF import and PDB loading.

0reactions
astrelskycommented, Mar 25, 2022

Yes. The “known issue” is “an error,” and that is the subject code that replaces the characters, but supposedly to ensure the underlying problems do not get triggered.

I make the exact same arguments to others on the team; I feel that someone or people on the team who did not know languages well made that decision, and that is exactly what I was repeating to someone on the team yesterday.

It is related to your #1175.

I’d like to fix it or have others fix it, but there are some underlying issues that are being worked on that have bearing on this issue.

That’s going pretty far back now. I mistook your initial response as a won’t fix and am willing to put up a fight about it. It may seem like a stupid and minor problem but when having to manually rename 100s of labels so that the correct this type gets used, as well as so it is correct, gets painfully tedious.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Underscore template throwing variable not defined error
You used to be able to parse and fill in an Underscore template in one go like this: var html = _.template(template_string, data);....
Read more >
Use underscores instead of hyphens in template filenames
Problem/Motivation Template suggestions use underscores but template files currently use hyphens. Now that we are using templates by default ...
Read more >
How to access underscore starting attributes in templates
Hi all of you. I need to pass a model to my template and then access its attributes. Some of them start with...
Read more >
template: allow undefined keys #237 - jashkenas/underscore
When the template function needs an element that is not defined it returns an Error. It would be great if the template function...
Read more >
SAP message 37620 I/O template must begin with an under
The first character of the template is replaced with an underscore. How to fix this error? Check the contents of the string. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found