summaryrefslogtreecommitdiffstats
path: root/src/symutil.cpp
diff options
context:
space:
mode:
authorsagitario <sagitario@fc51e93f-b9fe-4711-8d8d-3ae870c5f7d8>2011-05-08 07:45:27 (GMT)
committersagitario <sagitario@fc51e93f-b9fe-4711-8d8d-3ae870c5f7d8>2011-05-08 07:45:27 (GMT)
commit60cbfcd62a1d8c81b01342f302df4d06a1ae0cb2 (patch)
tree6f2e785043f726b8eb8f0fe8a37840029a0def3b /src/symutil.cpp
parentc50711be6be8b679d5e2b2a9849ced1665134268 (diff)
downloadcv2pdb-60cbfcd62a1d8c81b01342f302df4d06a1ae0cb2.zip
cv2pdb-60cbfcd62a1d8c81b01342f302df4d06a1ae0cb2.tar.gz
cv2pdb-60cbfcd62a1d8c81b01342f302df4d06a1ae0cb2.tar.bz2
* fixed decoding of compressed symbols
* added command line switch * fixed crash with more than 32767 types
Diffstat (limited to 'src/symutil.cpp')
-rw-r--r--src/symutil.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/symutil.cpp b/src/symutil.cpp
index 2660ea4..faed579 100644
--- a/src/symutil.cpp
+++ b/src/symutil.cpp
@@ -14,6 +14,7 @@ extern "C" {
#include <assert.h>
char dotReplacementChar = '@';
+bool demangleSymbols = true;
int dsym2c(const BYTE* p, int len, char* cname, int maxclen)
{
@@ -26,6 +27,33 @@ int dsym2c(const BYTE* p, int len, char* cname, int maxclen)
int ch = *p++;
if(ch == 0)
break;
+ if ((ch & 0xc0) == 0xc0)
+ {
+ zlen = (ch & 0x7) + 1;
+ zpos = ((ch >> 3) & 7) + 1; // + zlen;
+ if (zpos > cpos)
+ break;
+ for (int z = 0; z < zlen; z++)
+ cname[cpos + z] = cname[cpos - zpos + z];
+ cpos += zlen;
+ }
+ else if (ch >= 0x80)
+ {
+ if (p >= end)
+ break;
+ int ch2 = *p++;
+ zlen = (ch2 & 0x7f) | ((ch & 0x38) << 4);
+ if (p >= end)
+ break;
+ int ch3 = *p++;
+ zpos = (ch3 & 0x7f) | ((ch & 7) << 7);
+ if (zpos > cpos)
+ break;
+ for(int z = 0; z < zlen; z++)
+ cname[cpos + z] = cname[cpos - zpos + z];
+ cpos += zlen;
+ }
+#if 0
if (ch == 0x80)
{
if (p >= end)
@@ -48,13 +76,15 @@ int dsym2c(const BYTE* p, int len, char* cname, int maxclen)
cname[cpos + z] = cname[cpos - zpos + z];
cpos += zlen;
}
+#endif
else
cname[cpos++] = ch;
}
cname[cpos] = 0;
- if (cname[0] == '_' && cname[1] == 'D' && isdigit(cname[2]))
- d_demangle(cname, cname, maxclen, true);
+ if(demangleSymbols)
+ if (cname[0] == '_' && cname[1] == 'D' && isdigit(cname[2]))
+ d_demangle(cname, cname, maxclen, true);
#if 1
for(int i = 0; i < cpos; i++)