On second thought:
The DLL seems to work but causes frequent Visual Studio crashes. Anyone have any other experience with this?
The stable but less useful Data Visualizer snippet can be found here: http://wiki.team-pantheon.de/Bekannte_P ... bliotheken
Debugging CEGUI String
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 19
- Joined: Tue Feb 16, 2010 00:17
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Debugging CEGUI String
Hmmm. I'll try it out and try to reproduce and fix those crashes, but it likely will not be until the coming weekend.
CE.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
-
- Just popping in
- Posts: 19
- Joined: Tue Feb 16, 2010 00:17
Re: Debugging CEGUI String
Thanks CE.
The way I was producing the crash was the following:
I would put a breakpoint near some string. When the breakpoint was hit Visual Studio would pop up a message (can't remember exactly what it said) and asked it I wanted to Abort or Retry. If I hit retry everything worked fine and I could debug + look at the CEGUI::String. If I hit Abort then Visual Studio crashed.
Note- a couple reasons I thought of why mileage could vary:
Perhaps I compiled the DLL wrong or differently than I should have? It does work though.
I'm using VS2005. I would guess that VS2008 or VS2010 could be a completely different experience... remember that the autoexp.dat is a poorly supported feature.
The way I was producing the crash was the following:
I would put a breakpoint near some string. When the breakpoint was hit Visual Studio would pop up a message (can't remember exactly what it said) and asked it I wanted to Abort or Retry. If I hit retry everything worked fine and I could debug + look at the CEGUI::String. If I hit Abort then Visual Studio crashed.
Note- a couple reasons I thought of why mileage could vary:
Perhaps I compiled the DLL wrong or differently than I should have? It does work though.
I'm using VS2005. I would guess that VS2008 or VS2010 could be a completely different experience... remember that the autoexp.dat is a poorly supported feature.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Debugging CEGUI String
A little later than stated, I got around to re-testing this and was able to reproduce the issue easily (this is on VC++ 2008). Basically the core of the issue was where memory from the debugee was dumped into an auto variable of the same type in the extension code (this auto var obviously gets destroyed when it goes out of scope - which in this instance is a big no-no); what it should have done was to load the data into a raw buffer and cast the pointer.
I fixed that and cleaned up a couple of other bits also, and now offer up my replacement 'CEGUIDbg_String' function (everything else remains the same):
Hope it works for you too
CE.
I fixed that and cleaned up a couple of other bits also, and now offer up my replacement 'CEGUIDbg_String' function (everything else remains the same):
Code: Select all
ADDIN_API HRESULT WINAPI CEGUIDbg_String(DWORD dwAddress, DEBUGHELPER *pHelper,
int nBase, BOOL bUniStrings, char *pResult,
size_t max, DWORD reserved )
{
DWORD nGot;
void* rawPtr = new char[sizeof(CEGUI::String)];
if (pHelper->ReadDebuggeeMemory(pHelper, dwAddress, sizeof(CEGUI::String),
rawPtr, &nGot) != S_OK)
{
delete[] rawPtr;
return E_FAIL;
}
const CEGUI::String* const s = reinterpret_cast<CEGUI::String*>(rawPtr);
const int len = s->length();
CEGUI::String out_str;
if (len)
{
const int buff_size = sizeof(CEGUI::utf32) * len;
CEGUI::utf32* buf = new CEGUI::utf32[len + 1];
if (s->capacity() > STR_QUICKBUFF_SIZE)
{
if (pHelper->ReadDebuggeeMemory(pHelper, (DWORD)s->ptr(), buff_size,
buf, &nGot) != S_OK)
{
delete[] rawPtr;
delete[] buf;
return E_FAIL;
}
}
else
memcpy(buf, s->ptr(), buff_size);
for (int i = 0; i < len; i++)
out_str += buf[i];
delete[] buf;
}
CEGUI_print(pResult, max, len, out_str.c_str());
delete[] rawPtr;
return S_OK;
}
Hope it works for you too
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Return to “CEGUI Library Development Discussion”
Who is online
Users browsing this forum: No registered users and 3 guests