Skip to content

Commit 91bd142

Browse files
committed
Merge remote-tracking branch 'origin/patch'
2 parents d46419c + cc295e3 commit 91bd142

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

Ghidra/Features/MicrosoftDmang/src/main/java/mdemangler/template/MDTemplateArgumentsList.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ protected void parseInternal() throws MDException {
8686
}
8787
break;
8888
case '$':
89+
// "$$$V" and "$$V" (latter is MSVC15 version): case of ignore as argument.
8990
if ((dmang.peek(1) == '$') && (dmang.peek(2) == '$') &&
90-
(dmang.peek(3) == 'V')) { // Case of ignore as argument.
91+
(dmang.peek(3) == 'V')) {
9192
dmang.increment();
9293
dmang.increment();
9394
dmang.increment();
@@ -100,6 +101,18 @@ protected void parseInternal() throws MDException {
100101
}
101102
continue;
102103
}
104+
if ((dmang.peek(1) == '$') && (dmang.peek(2) == 'V')) {
105+
dmang.increment();
106+
dmang.increment();
107+
dmang.increment();
108+
if (args.isEmpty()) {
109+
// MDMANG SPECIALIZATION USED.
110+
// For "delimiters" MSFT bug: setting true even though we are
111+
// skipping parameter.
112+
needsComma = dmang.emptyFirstArgComma(this);
113+
}
114+
continue;
115+
}
103116
if (dmang.peek(1) == '$') { // This is the same as the "default" case below
104117
dt = MDDataTypeParser.parsePrimaryDataType(dmang, true);
105118
dt.parse();

Ghidra/Features/MicrosoftDmang/src/test/java/mdemangler/MDMangBaseTest.java

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* though many have been "genericized" with name components such as name0, name1,... These
4545
* tests are then run with different test configurations, though maybe not all of the time.
4646
* For instance, only one configuration is currently envisioned for being run during nightly
47-
* or continuous testing. The other tests are intended to be exercized while the code is
47+
* or continuous testing. The other tests are intended to be exercised while the code is
4848
* being modified.
4949
* As the developer of this demangler, I wanted to be able to have a demangler that could
5050
* provide demangled interpretations based upon what Microsoft said was truth (which is wrong
@@ -59,7 +59,7 @@
5959
* white spaces correct (including dangling white spaces)--as this provides insights into
6060
* the Microsoft model and helps ups to "believe" that we are on the right track; moreover,
6161
* it provides us with the ability to create large sets of data (millions of samples are
62-
* available from Windows 7 and Windows 10 symbols) against which we can run our demangleder
62+
* available from Windows 7 and Windows 10 symbols) against which we can run our demangler
6363
* and discover if we are doing better or worse with any given change. As an example, I
6464
* was able to make a change to this code base and run against the core set of tests below
6565
* and found that I broke no tests, but when I ran against the Windows 10 symbols, I failed
@@ -72,7 +72,7 @@
7272
* suites for any of these configurations are in class names of the form MDMangFooTest (all
7373
* derived from this class--MDMangBaseTest). If someone needs to run just a single test
7474
* method in this MDMangBaseTest with a different derived class from within Eclipse, then
75-
* they can do so by making two line changes below in the contructor of this class--effectively
75+
* they can do so by making two line changes below in the constructor of this class--effectively
7676
* transforming the class to look like one of its derived classes; at that point the developer
7777
* can right-click on the specific test and run or debug that single test method (of course
7878
* the constructor below should be changed back to its original form).
@@ -13699,6 +13699,17 @@ public void testWin10_1435301() throws Exception {
1369913699
demangleAndTest();
1370013700
}
1370113701

13702+
//Has "$$V" sequence (supposed MS2015 version of "$$$V" and comes from github issue #1220
13703+
@Test
13704+
public void testDollarDollarV_Issue1220() throws Exception {
13705+
mangled =
13706+
"??$Make@VProjectorViewFormats@Output@Host@DataModel@Debugger@@$$V@Details@WRL@Microsoft@@YA?AV?$ComPtr@VProjectorViewFormats@Output@Host@DataModel@Debugger@@@12@XZ";
13707+
msTruth =
13708+
"class Microsoft::WRL::ComPtr<class Debugger::DataModel::Host::Output::ProjectorViewFormats> __cdecl Microsoft::WRL::Details::Make<class Debugger::DataModel::Host::Output::ProjectorViewFormats>(void)";
13709+
mdTruth = msTruth;
13710+
demangleAndTest();
13711+
}
13712+
1370213713
//TODO: Need to do dispatcher for VS2017? vs. VS2015? We do not have VS2017 yet to see what it does.
1370313714
//TODO (20170331): Need to do some testing/fuzzing with something more up-to-date than VS2015.
1370413715
//Problem is at location 29-31 where we have a '?' followed by a 'C', which is trying to determine the encoded number, but the 'C'
@@ -14447,6 +14458,20 @@ public void testTemplatedOperator_3() throws Exception {
1444714458
demangleAndTest();
1444814459
}
1444914460

14461+
//TODO: considering for Issue 1162
14462+
@Ignore
14463+
public void testThreadSafeStaticGuard_1() throws Exception {
14464+
mangled =
14465+
"?$TSS0@?1??GetCategoryMap@CDynamicRegistrationInfoSource@XPerfAddIn@@SAPEBU_ATL_CATMAP_ENTRY@ATL@@XZ@4HA";
14466+
// mangled =
14467+
// "?xTSS0@?1??GetCategoryMap@CDynamicRegistrationInfoSource@XPerfAddIn@@SAPEBU_ATL_CATMAP_ENTRY@ATL@@XZ@4HA";
14468+
//TODO: investigate and consider what we should have as outputs.
14469+
msTruth = "";
14470+
mdTruth =
14471+
"int `public: static struct ATL::_ATL_CATMAP_ENTRY const * __ptr64 __cdecl XPerfAddIn::CDynamicRegistrationInfoSource::GetCategoryMap(void)'::`2'::`thread safe local static guard'";
14472+
demangleAndTest();
14473+
}
14474+
1445014475
//TODO: ignore for now.
1445114476
@Ignore
1445214477
public void testFuzzyFit() throws Exception {

0 commit comments

Comments
 (0)