Home » Developing U++ » Mac OS » MacOS X woes
|
|
| Re: MacOS X woes [message #7282 is a reply to message #7281] |
Wed, 20 December 2006 05:01   |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
D'oh, you should have said I need to delete my .ide/ config files since they are all big-endian 
However, we do get this situation:
rm .ide/ide.cfg
gdb ide
(gdb) run
(Once loaded, click Cancel instead of Selection a main Package)
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x1876d580
0x00275584 in Upp::RichEdit::SetupRuler (this=0xbfff707c) at Editor.cpp:272
272 zoom, q.grid, q.numbers, q.numbermul, q.marks);
(gdb) p unit
$1 = 16777216
And indeed, now that it has written "ide.cfg" it won't load it unless I delete it first, with the exact same core. So for some reason "unit" ends up big-endian in memory (as well as on disk?) even when Initialised from scratch.
[Updated on: Wed, 20 December 2006 05:02] Report message to a moderator
|
|
|
|
|
|
| Re: MacOS X woes [message #7284 is a reply to message #7227] |
Wed, 20 December 2006 08:57   |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
| lundman wrote on Mon, 18 December 2006 19:15 |
Ah whoopsie.. I assumed you had previously done CPU_PPC to be powerpc, since the PocketPC cpu arch is ARM, SH3 or MIPS.
I will guess what is needed here and submit a patch.
I use something along the lines of:
|
OK, now at the beginning of Core.h.
Mirek
[Updated on: Wed, 20 December 2006 08:58] Report message to a moderator
|
|
|
|
| Re: MacOS X woes [message #7285 is a reply to message #7283] |
Wed, 20 December 2006 09:14   |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
Right
Breakpoint 1, Upp::RichEdit::SerializeSettings (this=0xbfff707c, s=@0xbffe6c20) at /Users/lundman/src/upp/uppsrc/RichEdit/Editor.cpp:453
453 int version = 1;
(gdb) s
454 s / version;
(gdb) s
Upp::Stream::operator/ (this=0xbffe6c20, i=@0xbffe69b8) at Stream.h:223
223 Stream& operator/(int& i) { dword w = i + 1; Pack(w); i = w - 1; return *this; }
(gdb) s
Upp::Stream::Pack (this=0xbffe6c20, w=@0xbffe6958) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:471
471 if(IsError()) return;
(gdb) n
491 }
(gdb) n
0x0041d410 in Upp::Stream::operator/ (this=0xbffe6c20, i=@0xbffe69b8) at Stream.h:223
223 Stream& operator/(int& i) { dword w = i + 1; Pack(w); i = w - 1; return *this; }
(gdb) n
Upp::RichEdit::SerializeSettings (this=0xbfff707c, s=@0xbffe6c20) at /Users/lundman/src/upp/uppsrc/RichEdit/Editor.cpp:455
455 s % unit;
(gdb) p version
$4 = 1
(gdb) p unit
$5 = 1
(gdb) s
Upp::Stream::operator% (this=0xbffe6c20, d=@0xbfffb67c) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:585
585 SerializeRaw((dword *)&d, 1);
(gdb) s
Upp::Stream::SerializeRaw (this=0xbffe6c20, data=0xbfffb67c, count=1) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:457
457 SerializeRaw((byte *)data, 4 * count);
(gdb) s
Upp::Stream::SerializeRaw (this=0xbffe6c20, data=0xbfffb67c "", size=4) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:442
442 if(IsError()) return;
(gdb) n
447 }
(gdb) n
Upp::Stream::SerializeRaw (this=0xbffe6c20, data=0xbfffb67c, count=1) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:459
459 EndianSwap(data, count);
(gdb) p data
$6 = (dword *) 0xbfffb67c
(gdb) p *data
$7 = 1
(gdb) n
461 }
(gdb) p *data
$8 = 16777216
(gdb) n
Upp::Stream::operator% (this=0xbffe6c20, d=@0xbfffb67c) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:586
586 return *this;
(gdb)
587 }
(gdb)
Upp::RichEdit::SerializeSettings (this=0xbfff707c, s=@0xbffe6c20) at /Users/lundman/src/upp/uppsrc/RichEdit/Editor.cpp:456
456 s % showcodes;
(gdb) p unit
$9 = 16777216
Seems it is given a default value, then gets EndianSwapped, when maybe it should only be endianswapped when read?
|
|
|
|
| Re: MacOS X woes [message #7286 is a reply to message #7285] |
Wed, 20 December 2006 09:29   |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
| lundman wrote on Wed, 20 December 2006 03:14 |
Right
Breakpoint 1, Upp::RichEdit::SerializeSettings (this=0xbfff707c, s=@0xbffe6c20) at /Users/lundman/src/upp/uppsrc/RichEdit/Editor.cpp:453
453 int version = 1;
(gdb) s
454 s / version;
(gdb) s
Upp::Stream::operator/ (this=0xbffe6c20, i=@0xbffe69b8) at Stream.h:223
223 Stream& operator/(int& i) { dword w = i + 1; Pack(w); i = w - 1; return *this; }
(gdb) s
Upp::Stream::Pack (this=0xbffe6c20, w=@0xbffe6958) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:471
471 if(IsError()) return;
(gdb) n
491 }
(gdb) n
0x0041d410 in Upp::Stream::operator/ (this=0xbffe6c20, i=@0xbffe69b8) at Stream.h:223
223 Stream& operator/(int& i) { dword w = i + 1; Pack(w); i = w - 1; return *this; }
(gdb) n
Upp::RichEdit::SerializeSettings (this=0xbfff707c, s=@0xbffe6c20) at /Users/lundman/src/upp/uppsrc/RichEdit/Editor.cpp:455
455 s % unit;
(gdb) p version
$4 = 1
(gdb) p unit
$5 = 1
(gdb) s
Upp::Stream::operator% (this=0xbffe6c20, d=@0xbfffb67c) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:585
585 SerializeRaw((dword *)&d, 1);
(gdb) s
Upp::Stream::SerializeRaw (this=0xbffe6c20, data=0xbfffb67c, count=1) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:457
457 SerializeRaw((byte *)data, 4 * count);
(gdb) s
Upp::Stream::SerializeRaw (this=0xbffe6c20, data=0xbfffb67c "", size=4) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:442
442 if(IsError()) return;
(gdb) n
447 }
(gdb) n
Upp::Stream::SerializeRaw (this=0xbffe6c20, data=0xbfffb67c, count=1) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:459
459 EndianSwap(data, count);
(gdb) p data
$6 = (dword *) 0xbfffb67c
(gdb) p *data
$7 = 1
(gdb) n
461 }
(gdb) p *data
$8 = 16777216
(gdb) n
Upp::Stream::operator% (this=0xbffe6c20, d=@0xbfffb67c) at /Users/lundman/src/upp/uppsrc/Core/Stream.cpp:586
586 return *this;
(gdb)
587 }
(gdb)
Upp::RichEdit::SerializeSettings (this=0xbfff707c, s=@0xbffe6c20) at /Users/lundman/src/upp/uppsrc/RichEdit/Editor.cpp:456
456 s % showcodes;
(gdb) p unit
$9 = 16777216
Seems it is given a default value, then gets EndianSwapped, when maybe it should only be endianswapped when read?
|
Oops. I am stupid. There must be TWO swaps, one before SerializeRaw, second after it!
void Stream::SerializeRaw(word *data, dword count) {
#ifdef CPU_BE
EndianSwap(data, count);
#endif
SerializeRaw((byte *)data, 2 * count);
#ifdef CPU_BE
EndianSwap(data, count);
#endif
}
void Stream::SerializeRaw(dword *data, dword count) {
#ifdef CPU_BE
EndianSwap(data, count);
#endif
SerializeRaw((byte *)data, 4 * count);
#ifdef CPU_BE
EndianSwap(data, count);
#endif
}
void Stream::SerializeRaw(uint64 *data, dword count) {
#ifdef CPU_BE
EndianSwap(data, count);
#endif
SerializeRaw((byte *)data, 8 * count);
#ifdef CPU_BE
EndianSwap(data, count);
#endif
}
(later we most likely should speed optimize that)
Mirek
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: MacOS X woes [message #7299 is a reply to message #7292] |
Thu, 21 December 2006 02:21   |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
As requested, attached file.
I guess I could also mention two other things, they don't really affect the usage of U++, but sometimes perfection is desirable.
When a Window is minimized (or possibly removed) Console gets:
X Error: BadMatch (invalid parameter attributes), request: X_SetInputFocus, resource id: 6295038 = 600DFE
but it is just noisy, no noticable impact.
And when you exit the Ide:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x000004d0
0x00f20468 in XQueryExtension ()
(gdb) bt
#0 0x00f20468 in XQueryExtension ()
#1 0x00f161c0 in XInitExtension ()
#2 0x018bf34c in XextAddDisplay ()
#3 0x00df11e0 in XRenderFreePicture ()
#4 0x00320568 in Upp::Image::Data::SysRelease (this=0x1bd3488) at /Users/lundman/src/upp/uppsrc/Draw/ImageX11.cpp:63
#5 0x002fdbf4 in Upp::Image::Data::~Data (this=0x1bd3488) at Image.cpp:324
#6 0x005850dc in Upp::Image::Data::Release (this=0x1bd3488) at Image.h:117
#7 0x002fdd04 in Upp::Image::~Image (this=0x200993c) at Image.cpp:278
#8 0x0044928c in Upp::Iml::IImage::~IImage (this=0x2009938) at Image.h:253
#9 0x0045a694 in Upp::DestroyArray<Upp::Iml::IImage> (t=0x2009938, lim=0x2009a10) at Topt.h:175
#10 0x0045a76c in Upp::Vector<Upp::Iml::IImage>::Free (this=0x91ea40) at Vcont.hpp:101
#11 0x0045a80c in Upp::Vector<Upp::Iml::IImage>::~Vector (this=0x91ea40) at Vcont.h:82
#12 0x0045a848 in Upp::AMap<Upp::String, Upp::Iml::IImage, Upp::Vector<Upp::Iml::IImage>, Upp::StdHash<Upp::String> >::~AMap (this=0x91ea04) at Map.h:2
#13 0x0045a8c0 in Upp::VectorMap<Upp::String, Upp::Iml::IImage, Upp::StdHash<Upp::String> >::~VectorMap (this=0x91ea00) at Map.h:130
#14 0x0047571c in Upp::Iml::~Iml (this=0x91e9f4) at Image.h:252
#15 0x002ae584 in __tcf_0 () at iml_source.h:54
#16 0x00003a44 in cxa_atexit_wrapper ()
#17 0x9001455c in __cxa_finalize ()
#18 0x90014444 in exit ()
#19 0x00002c58 in _start ()
#20 0x00002958 in start ()
But all files are saved correctly, so again, no impact, just not "clean". I used File/Exit there, but same happens when you push Close X-icon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: MacOS X woes [message #7351 is a reply to message #7342] |
Sat, 23 December 2006 10:58   |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
It was your fix
Color.h:
#ifdef PLATFORM_WIN32
struct RGBA : Moveable<RGBA> {
byte b, g, r, a;
};
#endif
#ifdef PLATFORM_POSIX
#ifdef CPU_BE
struct RGBA : Moveable<RGBA> {
byte a, r, g, b;
};
#else
struct RGBA : Moveable<RGBA> {
byte b, g, r, a;
};
#endif
#endif
#ifndef PLATFORM_WIN32
"path" is defined in .lay, I checked, but it just doesn't want to compile 
bmphdr (looks like no change):
/Users/lundman/src/upp/uppsrc/plugin/bmp/bmphdr.h: In member function 'void Upp::BMP_FILEHEADER::SwapEndian()':
/Users/lundman/src/upp/uppsrc/plugin/bmp/bmphdr.h:18: error: no matching function for call to 'Upp::BMP_FILEHEADER::SwapEndian(Upp::word&)
'
/Users/lundman/src/upp/uppsrc/plugin/bmp/bmphdr.h:15: note: candidates are: void Upp::BMP_FILEHEADER::SwapEndian()
/Users/lundman/src/upp/uppsrc/plugin/bmp/bmphdr.h:19: error: no matching function for call to 'Upp::BMP_FILEHEADER::SwapEndian(Upp::dword&
)'
etc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: MacOS X woes [message #7375 is a reply to message #7368] |
Sun, 24 December 2006 01:58   |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
Great. Do I need to send you that file?
Also, possible bug, on my colleague's machine, which don't have much of the X11 stuff, he dies in XftCharExists(), from DrawTextXftp.cpp:86.
XftFont *xftfont = XftFontOpen(Xdisplay, Xscreenno,
XFT_FAMILY, XftTypeString, (char *)face,
XFT_PIXEL_SIZE, XftTypeInteger, 20,
(void *)0);
int n = 0;
for(int c = 0; c < 128; c++)
if(!XftCharExists(Xdisplay, xftfont, c + 256))
n++;
So I added:
XftFont *xftfont = XftFontOpen(Xdisplay, Xscreenno,
XFT_FAMILY, XftTypeString, (char *)face,
XFT_PIXEL_SIZE, XftTypeInteger, 20,
(void *)0);
if (!xftfont) return 0;
int n = 0;
Which stops it from coring and gets further in.
Lund
|
|
|
|
|
|
| Re: MacOS X woes [message #7382 is a reply to message #7381] |
Tue, 26 December 2006 08:58   |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
| lundman wrote on Tue, 26 December 2006 01:20 |
After fixing that Xft issue, it actually starts the application, but dies in Acquire() later on, so I guess his Xft is returning many non-standard things (he seems to have no X11 fonts).
f->xftfont = CreateXftFont(font, angle);
f->filename = NULL;
f->ascent = (int16)f->xftfont->ascent;
f->descent = (int16)f->xftfont->descent;
Which happens because CreateXftFont() returns NULL. But I am unsure how to fix this, or if we would just consider it "too broken" not to have fonts?
|
Yes, too broken. I would not waste the time with this; the final Mac solution should use Carbon anyway, I consider this effort as an intermediate step (but very important, because we have actually fixed all CPU incompatibility bugs in this productive session).
Mirek
|
|
|
|
|
|
|
|
|
|
|
|
| Re: MacOS X woes [message #7427 is a reply to message #7406] |
Fri, 29 December 2006 05:41   |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
While looking into your "No 1" task, I discovered PackageOrganiser/Add/Remove-Flags.. siigghh.. all my complaining about no link-options Anyway, it would be nice if the "WHEN" could also sense the BuildEnvironment-name used. "GCC32" and "GCC32CARBON" or what not.
Anyway, very simple carbon app compiled in U++ as "Core console project", straight out of developer.apple.com, so no credits to me:
UPPCarbon.cpp:
#include <Carbon/Carbon.h>
#include "UPPCarbon.h"
#define kWindowTop 100
#define kWindowLeft 50
#define kWindowRight 250
#define kWindowBottom 250
const EventTypeSpec eventList[] =
{
{ kEventClassWindow, kEventWindowClose },
{ kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated },
};
static pascal OSStatus MyWindowEventHandler(EventHandlerCallRef nextHandler,
EventRef theEvent,
void *userData)
{
OSStatus result = eventNotHandledErr;
WindowRef theWindow = (WindowRef) userData;
UInt32 whatHappened;
whatHappened = GetEventKind(theEvent);
switch(whatHappened) {
case kEventWindowClose:
DisposeWindow(theWindow);
QuitApplicationEventLoop();
result = noErr;
break;
case kEventWindowActivated:
::CallNextEventHandler(nextHandler, theEvent);
result = noErr;
break;
case kEventWindowDeactivated:
::CallNextEventHandler(nextHandler, theEvent);
result = noErr;
break;
}
return result;
}
void Initialize(void)
{
// Do one-time-only initialization
WindowRef theWindow;
WindowAttributes windowAttrs;
Rect contentRect;
EventHandlerUPP handlerUPP;
windowAttrs = kWindowStandardDocumentAttributes |
kWindowStandardHandlerAttribute;
SetRect(&contentRect, kWindowLeft, kWindowTop,
kWindowRight, kWindowBottom);
CreateNewWindow(kDocumentWindowClass, windowAttrs,
&contentRect, &theWindow);
SetWindowTitleWithCFString(theWindow, CFSTR("U++ Carbon Example"));
handlerUPP = NewEventHandlerUPP(MyWindowEventHandler);
InstallWindowEventHandler(theWindow, handlerUPP,
GetEventTypeCount(eventList), eventList,
theWindow, NULL);
ShowWindow(theWindow);
InitCursor();
}
void Finalize(void)
{
}
using namespace UPP;
CONSOLE_APP_MAIN
{
Initialize(); // Do one-time-only initialization
RunApplicationEventLoop(); //Process events until time to quit
Finalize(); // Do one-time-only finalization
}
Extra link flags, and post-link step added:
UPPCarbon.upp:
flags(OSX11) "-framework carbon";
uses
Core;
link(OSX11) " -framework carbon";
file
UPPCarbon.h,
UPPCarbon.cpp;
mainconfig
"" = "";
custom(OSX11) "post-link",
"mkdir -p $(OUTTITLE).App/Contents/MacOS\ncp $(OUTPATH) $(OUTTITLE).App"
"/Contents/MacOS",
"";
And yes, creating the UPPCarbon.App/Contents/MacOs/ is required for it to fully function.
Looks like:
http://netbsd.interq.or.jp/~lundman/carbon.jpg
-
Attachment: carbon.jpg
(Size: 31.89KB, Downloaded 1868 times)
|
|
|
|
|
|
| Re: MacOS X woes [message #7449 is a reply to message #7430] |
Sat, 30 December 2006 09:16   |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
Thanks, that was quite fun, and the apple docs are pretty good.
But yes, we need someway to be able to specify linker flags, I think you should just add link options, next to compile options in the build environment, but I guess I can also get around that with -Wl,flags but that is very noisy.
Also, the ide leaves a lot of zombies around when compiling, are you calling wait(3) properly on the children?
Lund
|
|
|
|
|
|
|
|
| Re: MacOS X woes [message #9098 is a reply to message #7375] |
Tue, 17 April 2007 10:11  |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
| lundman wrote on Sat, 23 December 2006 19:58 | Great. Do I need to send you that file?
Also, possible bug, on my colleague's machine, which don't have much of the X11 stuff, he dies in XftCharExists(), from DrawTextXftp.cpp:86.
|
BTW, as I was stucked a day or two at the same trouble, the one thing that heals this issue is:
sudo fc-cache
After that, TheIDE finally starts again...
Mirek
|
|
|
|
Goto Forum:
Current Time: Mon Oct 05 18:54:03 GMT+2 2026
Total time taken to generate the page: 0.01557 seconds
|