Author Topic: Frame issue with the debugger plugin  (Read 21461 times)

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
32-bit build on linux broken
« Reply #60 on: October 23, 2015, 08:47:09 pm »
It seems that commit 10539 together with 10540 break 32-bit build on linux.
See this error log-snippet:
Code: [Select]
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
  1. @@ -459,6 +472,30 @@ wxString cbDetectDebuggerExecutable(const wxString &exeName)
  2.      return exePath + wxFileName::GetPathSeparator() + exeName + exeExt;
  3.  }
  4.  
  5. +uint64_t cbDebuggerStringToAddress(const wxString &address)
  6. +{
  7. +    if (address.empty())
  8. +        return 0;
  9. +#if defined(__WXMSW__)
  10. +    // Workaround for the 'ToULongLong' bug in wxWidgets 2.8.12
  11. +#if wxCHECK_VERSION(2, 8, 12)
  12. +    return strtoull(address.mb_str(), nullptr, 16);
  13. +#else
  14. +    uint64_t result;
  15. +    if (address.ToULongLong(&result))
  16. +        return result;
  17. +    else
  18. +        return 0;
  19. +#endif // wxCHECK_VERSION
  20. +#else
  21. +    uint64_t result;
  22. +    if (address.ToULong(&result, 16))
  23. +        return result;
  24. +    else
  25. +        return 0;
  26. +#endif
  27. +}
  28. +
  29.  
  30.  class DebugTextCtrlLogger : public TextCtrlLogger
  31.  {
  32.  

(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) ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: 32-bit build on linux broken
« Reply #61 on: October 23, 2015, 09:08:24 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.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!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: 32-bit build on linux broken
« Reply #62 on: October 23, 2015, 11:04:19 pm »
Also can you move these two posts in the original topic?
Done.

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.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Frame issue with the debugger plugin
« Reply #63 on: October 23, 2015, 11:12:00 pm »
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Frame issue with the debugger plugin
« Reply #64 on: October 24, 2015, 12:06:24 am »
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!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Frame issue with the debugger plugin
« Reply #65 on: October 24, 2015, 01:07:23 am »
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.