private:
FILE *m_fp;
- DECLARE_NO_COPY_CLASS(wxStdioPipe)
+ wxDECLARE_NO_COPY_CLASS(wxStdioPipe);
};
// ============================================================================
// format is: "module(funcname+offset) [address]" but the part in
// parentheses can be not present
wxString syminfo = wxString::FromAscii(m_syminfo);
- const size_t posOpen = syminfo.find(_T('('));
+ const size_t posOpen = syminfo.find(wxT('('));
if ( posOpen != wxString::npos )
{
- const size_t posPlus = syminfo.find(_T('+'), posOpen + 1);
+ const size_t posPlus = syminfo.find(wxT('+'), posOpen + 1);
if ( posPlus != wxString::npos )
{
- const size_t posClose = syminfo.find(_T(')'), posPlus + 1);
+ const size_t posClose = syminfo.find(wxT(')'), posPlus + 1);
if ( posClose != wxString::npos )
{
if ( m_name.empty() )
// build the (long) command line for executing addr2line in an optimized way
// (e.g. use always chars, even in Unicode build: popen() always takes chars)
- int len = snprintf(g_buf, BUFSIZE, "addr2line -C -f -e \"%s\"", exepath.mb_str());
+ int len = snprintf(g_buf, BUFSIZE, "addr2line -C -f -e \"%s\"", (const char*) exepath.mb_str());
len = (len <= 0) ? strlen(g_buf) : len; // in case snprintf() is broken
for (size_t i=0; i<n; i++)
{
// parse addr2line output (should be exactly 2 lines for each address)
// reusing the g_buf used for building the command line above
wxString name, filename;
- unsigned long line, curr=0;
- for (size_t i=0; i<n; i++)
+ unsigned long line = 0,
+ curr = 0;
+ for ( size_t i = 0; i < n; i++ )
{
// 1st line has function name
if ( fgets(g_buf, WXSIZEOF(g_buf), fp) )
name = wxString::FromAscii(g_buf);
name.RemoveLast(); // trailing newline
- if ( name == _T("??") )
+ if ( name == wxT("??") )
name.clear();
}
else
{
- wxLogDebug(_T("cannot read addr2line output for %d-th stack frame!"), i);
+ wxLogDebug(wxT("cannot read addr2line output for stack frame #%lu"),
+ (unsigned long)i);
return false;
}
filename = wxString::FromAscii(g_buf);
filename.RemoveLast();
- const size_t posColon = filename.find(_T(':'));
+ const size_t posColon = filename.find(wxT(':'));
if ( posColon != wxString::npos )
{
- // parse line number
- if ( !wxString(filename, posColon + 1, wxString::npos).
- ToULong(&line) )
- line = 0;
+ // parse line number (it's ok if it fails, this will just leave
+ // line at its current, invalid, 0 value)
+ wxString(filename, posColon + 1, wxString::npos).ToULong(&line);
// remove line number from 'filename'
filename.erase(posColon);
- if ( filename == _T("??") )
+ if ( filename == wxT("??") )
filename.clear();
}
else
{
- wxLogDebug(_T("Unexpected addr2line format: \"%s\" - ")
- _T("the semicolon is missing"),
+ wxLogDebug(wxT("Unexpected addr2line format: \"%s\" - ")
+ wxT("the semicolon is missing"),
filename.c_str());
}
}
- if (!name.empty() || !filename.empty())
- {
- // now we've got enough info to initialize curr-th stack frame:
- arr[curr++].Set(name, filename, syminfo[i], i, line, addresses[i]);
- }
+ // now we've got enough info to initialize curr-th stack frame
+ // (at worst, only addresses[i] and syminfo[i] have been initialized,
+ // but wxStackFrame::OnGetName may still be able to get function name):
+ arr[curr++].Set(name, filename, syminfo[i], i, line, addresses[i]);
}
return curr;