Re: string length on Mac

"John Selverian" <[email protected]> Tue, 16 Apr 2024 19:16:53 -0400
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization JAHM Software
Message-ID <[email protected]>
I fixed it. There must be a difference in the compilers on the
different platforms.

I had a "const FXString" defined in a different class, I included
the header in my other files and it worked on Windows and Linux
but crashed on the Mac. It compiled fine on the Mac...it just
won't run. The declaration was accepted to get it past the
compiler but it was not allocated int eh actual code at run-time.
I added a local definition for this constant and now it works on
the Mac.

Js



-----Original Message-----
From: John Selverian <[email protected]> 
Sent: Tuesday, April 16, 2024 6:35 PM
To: 'Jeroen van der Zijp' <[email protected]>
Cc: [email protected]
Subject: Re: [Foxgui-users] string length on Mac

This is part of the dump I see:



System Integrity Protection: enabled

Notes:
PC register does not match crashing frame (0x0 vs 0x1237BC28F)

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xfffffffffffffffc
Exception Codes:       0x0000000000000001, 0xfffffffffffffffc

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation
fault: 11
Terminating Process:   exc handler [32740]

VM Region Info: 0xfffffffffffffffc is not in any region.  Bytes
after previous region: 18446603349843460093  
      REGION TYPE                    START - END         [ VSIZE]
PRT/MAX SHRMOD  REGION DETAIL
      unused __TEXT            7ffca5bc0000-7ffcd40cc000 [741.0M]
r-x/r-x SM=COW  unused  unknown system shared lib __TEXT
--->  
      UNUSED SPACE AT END

Error Formulating Crash Report:
PC register does not match crashing frame (0x0 vs 0x1237BC28F)

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libFOX-1.7.0.dylib            	       0x1237bc28f
FX::FXString::length() const + 15
1   libFOX-1.7.0.dylib            	       0x1239fb0af
FX::FXString::append(FX::FXString const&) + 47
2   libFOX-1.7.0.dylib            	       0x123a0177c
FX::operator+(FX::FXString const&, FX::FXString const&) + 60
3   MPDB                          	       0x10821b267
__cxx_global_var_init.31 + 55
4   MPDB                          	       0x10821b859
_GLOBAL__sub_I_ReferencesAlAlloys.cpp + 89
5   dyld                          	       0x20e45639f
invocation function for block in
dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&)
const::$_0::operator()() const + 185
6   dyld                          	       0x20e4904c8
invocation function for block in
dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&,
dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int)
block_pointer, void const*) const + 133
7   dyld                          	       0x20e484bcf
invocation function for block in
dyld3::MachOFile::forEachSection(void
(dyld3::MachOFile::SectionInfo const&, bool, bool&)
block_pointer) const + 543
8   dyld                          	       0x20e43b07f
dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void
(load_command const*, bool&) block_pointer) const + 249
9   dyld                          	       0x20e483d0c
dyld3::MachOFile::forEachSection(void
(dyld3::MachOFile::SectionInfo const&, bool, bool&)
block_pointer) const + 176
10  dyld                          	       0x20e4861b0
dyld3::MachOFile::forEachInitializerPointerSection(Diagnostics&,
void (unsigned int, unsigned int, bool&) block_pointer) const +
116
11  dyld                          	       0x20e4901fe
dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&,
dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int)
block_pointer, void const*) const + 390
12  dyld                          	       0x20e4530cd
dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&)
const + 225
13  dyld                          	       0x20e4589c9
dyld4::JustInTimeLoader::runInitializers(dyld4::RuntimeState&)
const + 21
14  dyld                          	       0x20e4532e5
dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&,
dyld3::Array<dyld4::Loader const*>&) const + 213
15  dyld                          	       0x20e456414
dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::Runt
imeState&) const::$_1::operator()() const + 98
16  dyld                          	       0x20e45337e
dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::Runt
imeState&) const + 96
17  dyld                          	       0x20e472d9a
dyld4::APIs::runAllInitializersForMain() + 326
18  dyld                          	       0x20e440203
dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3364
19  dyld                          	       0x20e43f2ff start
+ 1839

Thread 1:: com.apple.rosetta.exceptionserver
0   runtime                       	    0x7ff7ffc40494
0x7ff7ffc3c000 + 17556


Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000010dc7da78  rbx: 0x000000010821b800  rcx:
0x00007fbe197169af  rdx: 0xffffffffffffffef
  rdi: 0x0000000000000000  rsi: 0x0000000000000000  rbp:
0x0000000315519020  rsp: 0x0000000315519020
   r8: 0x0000000000000128   r9: 0x6f642f2f3a737074  r10:
0x30312f67726f2e69  r11: 0x31732f373030312e
  r12: 0x000000010dc72518  r13: 0x0000000102ffc558  r14:
0x0000000315519668  r15: 0x0000000315519158
  rip: <unavailable>       rfl: 0x0000000000000206
 tmp0: 0x0000000123cf0078 tmp1: 0x0000000124162f80 tmp2:
0x00000001237bc280






-----Original Message-----
From: Jeroen van der Zijp <[email protected]>
Sent: Tuesday, April 16, 2024 6:04 PM
To: John Selverian <[email protected]>
Cc: [email protected]
Subject: Re: [Foxgui-users] string length on Mac

On Tue, 16 Apr 2024 17:20:41 -0400
"John Selverian" <[email protected]> wrote:

> My program is crashing on start-up on the Mac.  It works fine
on 
> Windows and Linux. I can't catch it in the debugger, it crashes
in 
> FXString::length() in the fox lib. I have some long strings (up
to 
> 2000 chars). Could this be the problem? Is there a length limit
for 
> FXString?

Length limit is, basically, MAX_INT (2**31-1).  Why does it
crash?  I don't know.  I assume you've at least executed the
FXString constructor?  FXString is essentially a pointer to a
text buffer, preceded by the size of the string [there's an extra
byte at the end, not accounted for in the length].

An empty string is a special pointer, which is preceeded by a
count of 0, and whose contents is a single end-of-string
character ('\0').




    -- JVZ



_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users