Page 1 of 1

Kick out on PB > 6.04 when handling XML files

Posted: Fri Jun 14, 2024 1:34 pm
by pTb
Hi guys,
before I'm diving in to boil down my code to get the exact code that fails, I'd like to ask if anyone of You have encountered problems with the XML file library on PB versions higher than 6.04?

The fifth line from the bottom in my code below fails hard every time - like if the nodes would be zero (which is not the case).

As soon as I use older versions of PureBasic everything is fine.

Yeah, I know the code doesn't say very much since I just made a snapshot of it as it is. :wink:

If this is a non heard of problem, I might take a deeper dive into this and try to isolate the exact code that can fail on PB6.10 and 6.11.

Code: Select all

        Case "PATTERNS"
          ;Debug file$
          *child = ChildXMLNode(*node)
          flagDeleted = #False
          While *child
            If UCase(GetXMLNodeName(*child)) = "PATTERN" And ExamineXMLAttributes(*child) = #True
              ;Debug "patterns found"
              a$ = GetXMLNodeText(*child)
              If Left(a$, 2) = ".\"
                a$ = Preferences::dataRoot$ + Right(a$, Len(a$) - 2)
              EndIf
              Debug "Pattern: " + file$ + " : " + a$
              
              Select UCase(GetExtensionPart(a$)) 
                  
                Case "DXF", "CPX"
                  myNode = ChooseNode(xml, "MARKER/INSERTS/INSERT/")
                  n = 0
                  While myNode
                    If GetXMLAttribute(myNode, "PatID") = GetXMLAttribute(*child, "ID") ; this line fails every time with PB > 6.04
                      n + 1
                    EndIf
                    myNode = NextXMLNode(myNode)
                  Wend

Re: Kick out on PB > 6.04 when handling XML files

Posted: Sat Jun 15, 2024 7:05 am
by pTb
Okay, now I have made some more tests.

At first, when I compiled and ran the source code here at home, everything worked just fine with PB6.10... :?:

I then ran the copy that I've got in another location that I share with my work computer - and it crashed in the same way as yesterday...

Now I have compared all files and there's only one difference. In the project file, the <compiler version> tag says x64 in my standard folder but x86 in the copy.

Does this mean that PureBasic comes with both versions even though I'm installing x64? I can't verify this now, but I think I have only installed x64 on my work computer. But I must check that on Monday.

The weird thing here. Why does 6.10 and 6.11 try to compile x86 even though they are x64 installs? Is that really okay? And how can they even compile?
Weird thing two. Why does 6.04 or older manage this difference? I haven't verified what kind of code any of the compilers have created.

Now, when I found the difference in the project file, I could just change that to x64 and everything is fine. What I wonder is how that could be from the beginning. When I upgraded to 6.11 I remember an error message saying it couldn't find the compiler and I just pointed PB to it. After what I can see, there are only two compilers in the compiler folder - the one for assembler and the one for c.

Furthermore, I even tried uninstalling and delete everything for PureBasic yesterday at work (both program files and program x86 - which were empty) before installing PB again.

Is this anything interesting to find a solution to or should I just go on with my life? :)

Re: Kick out on PB > 6.04 when handling XML files

Posted: Sat Jun 15, 2024 9:33 am
by mk-soft
PureBasic x86 and x64 use the same purebasic.pref file. If a different compiler is entered there, it can also happen that the wrong compiler is used.
Please put in an executable code to check. Could still be a bug in the x86 version.

Path to the settings file ... C:\Users\[username]\AppData\Roaming\PureBasic or easy %appdata%

Re: Kick out on PB > 6.04 when handling XML files

Posted: Sat Jun 15, 2024 4:37 pm
by pTb
Ah, okay. Now I have checked this and apparently my home computer that has both x86 and x64 versions, compiled this code with the x86 version. That's why it worked at home.

So, now PB6.10 x64 and 6.11 x64 doesn't work with *any* copy of my code on *any* computer. At least it's consistent now. :)

I immediately suspected the wrong byte length on the variables causing the fail, but since they are integer, they should be 8 bytes on the x64 versions...

And why would PB 6.04 x64 work? That version works on both computers with the same code. :scratching my chin:

edit: I checked the TypeOf() on myNode and *child. Both are indeed integers.

Re: Kick out on PB > 6.04 when handling XML files

Posted: Sun Jun 16, 2024 12:50 am
by idle
Did you try the purifier? some of the changes between 6.04 and 6.11 have exposed quite a few silent bugs

Re: Kick out on PB > 6.04 when handling XML files

Posted: Sun Jun 16, 2024 6:30 am
by pTb
Yes, tried purifier. No diff. Just 'Invalid memory access - address xxxxxxxxxxx'

Re: Kick out on PB > 6.04 when handling XML files

Posted: Sun Jun 16, 2024 6:49 am
by pTb
I have found the culprit.

My procedure ChooseNode was defined with a return value of type .l by accident. Should of course be .i

Still wondrous that it has worked on older PB x64 versions. Maybe the XML library wasn't x64 until recently?

Anyhow, thanks for Your input, guys. Back to bean stringing again (from 'the Villain - 1979). :mrgreen:

Re: Kick out on PB > 6.04 when handling XML files

Posted: Sun Jun 16, 2024 6:51 am
by idle
pTb wrote: Sun Jun 16, 2024 6:49 am I have found the culprit.

My procedure ChooseNode was defined with a return value of type .l by accident. Should of course be .i

Still wondrous that it has worked on older PB x64 versions. Maybe the XML library wasn't x64 until recently?

Anyhow, thanks for Your input, guys. Back to bean stringing again (from 'the Villain - 1979). :mrgreen:
Well that would do it. :lol:
Glad you found it.
I also had code with long returns and sat there scratching my head because it worked for many years despite it being wrong