News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Frame issue with the debugger plugin

Started by scarphin, March 30, 2015, 01:48:23 PM

Previous topic - Next topic

Jenna

It seems that commit 10539 together with 10540 break 32-bit build on linux.
See this error log-snippet:
debuggermanager.cpp: In function 'uint64_t cbDebuggerStringToAddress(const wxString&)':
debuggermanager.cpp:488:36: error: no matching function for call to 'wxString::ToULong(uint64_t*, int) const'
     if (address.ToULong(&result, 16))
                                    ^
In file included from /usr/include/wx-2.8/wx/artprov.h:15:0,
                 from debuggermanager.cpp:12:
/usr/include/wx-2.8/wx/string.h:1188:10: note: candidate: bool wxString::ToULong(long unsigned int*, int) const
     bool ToULong(unsigned long *val, int base = 10) const;
          ^
/usr/include/wx-2.8/wx/string.h:1188:10: note:   no known conversion for argument 1 from 'uint64_t* {aka long long unsigned int*}' to 'long unsigned int*'

The cause is the use of this newly added function:

Code (diff) Select
@@ -459,6 +472,30 @@ wxString cbDetectDebuggerExecutable(const wxString &exeName)
     return exePath + wxFileName::GetPathSeparator() + exeName + exeExt;
}

+uint64_t cbDebuggerStringToAddress(const wxString &address)
+{
+    if (address.empty())
+        return 0;
+#if defined(__WXMSW__)
+    // Workaround for the 'ToULongLong' bug in wxWidgets 2.8.12
+#if wxCHECK_VERSION(2, 8, 12)
+    return strtoull(address.mb_str(), nullptr, 16);
+#else
+    uint64_t result;
+    if (address.ToULongLong(&result))
+        return result;
+    else
+        return 0;
+#endif // wxCHECK_VERSION
+#else
+    uint64_t result;
+    if (address.ToULong(&result, 16))
+        return result;
+    else
+        return 0;
+#endif
+}
+

class DebugTextCtrlLogger : public TextCtrlLogger
{


(1) Is there any reason for the #if defined(__WXMSW__) ?
(2) And if yes, shouldn't it be address.ToUlongLong in the else-clause ?

Or in other words, is the ToUlongLong-bug (which ?) a windows-only (2) bug or is it a bug on all systems (1) ?

oBFusCATed

Quote from: jens on October 23, 2015, 08:47:09 PM
(1) Is there any reason for the #if defined(__WXMSW__) ?
(2) And if yes, shouldn't it be address.ToUlongLong in the else-clause ?

Or in other words, is the ToUlongLong-bug (which ?) a windows-only (2) bug or is it a bug on all systems (1) ?

This is the original topic http://forums.next.codeblocks.org/index.php/topic,20155.0.html
I think you can find the bug report about toulonglong there.
Probably I've messed it a bit here.
We should always use ToULongLong on windows, because sizeof(long)==4 there.
See this table https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models

Probably we should use ToULongLong on 32bit linux/osx. Can you detect this case?

Also can you move these two posts in the original topic?

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

Quote from: oBFusCATed on October 23, 2015, 09:08:24 PM
Also can you move these two posts in the original topic?
Done.

Quote from: oBFusCATed on October 23, 2015, 09:08:24 PM
Probably we should use ToULongLong on 32bit linux/osx. Can you detect this case?
I think this should work.
I can test the build on my copr-site, but not whether it works or not (at the moment).
I'm not at home until sunday, so I can not set up a 32bit test-machine (too slow internet) and I will only be at home for some hours sunday evening.

Jenna

Another thing I just stumbled about:
all calls of string2ulong[long] in the cbDebuggerStringToAddress-function have a base of 16, except the ToULongLong-call for wx > 2.8.12 on windows.

oBFusCATed

This last thing is a bug, if you're committing please fix it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

In trunk.
I need to distinguish between 64bit and 32bit, because of the different size of long/long long.
It builds now, but is not tested on 32bit linux and not tested at all on Mac.