Spasm Linux Errors

  • Author
  • Message
Offline
User avatar

NanoWar

Site Admin

Topic Starter

Spasm Linux Errors

Post12 October 2011, 09:15

With GNU-Debugger I tracked runtime errors:
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
0x0000000000408917 in handle_bitmap(_IO_FILE*, tagRECT const*, tagBITMAPFILEHEADER const*, tagBITMAPINFOHEADER const*, tagRGBQUAD*) ()

(Compiling Wizards)
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux

Post17 October 2011, 10:44

Wanna send me your code for assembling wizards? We dont have a lot of tests dealing with bitmaps, we probably should. That code needs cleaning up anyway hopefully this will be an excuse to do so.
Offline
User avatar

NanoWar

Site Admin

Topic Starter

Re: Spasm Linux

Post17 October 2011, 12:23

It segfaults on any bitmap inclusion. Trivial example is in the attachment.
Attachments
spasm-bitmap-crash.zip
(73.5 KiB) Downloaded 400 times
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux

Post19 October 2011, 18:56

Hmm confirmed, athough I'm not sure whats causing this. Theres no issue on windows, and Spencer says the mac version doesn't have a problem either. Guess its time for some command line gdb :/
Offline
User avatar

NanoWar

Site Admin

Topic Starter

Re: Spasm Linux

Post20 October 2011, 15:33

How do you professionally debug a C program in Linux? I dont think GDB command line is any fun...

Re: Spasm Linux

Post24 October 2011, 03:08

You could use an IDE I would think. Eclipse and KDevelop are two good ones.
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux Errors on Bitmaps

Post24 October 2011, 03:58

Most people on linux have there own system of doing things, IDEs are probably the easiest way, but most people are already using vi or emacs, which both have plugins for using debugging tools I believe. And yeah at first I was skeptical of command line debugging but actually its very doable, although a little slower than stepping through with an IDE.
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux Errors on Bitmaps

Post24 October 2011, 08:44

Got it. LONG was incorrectly defined as unsigned and it was stuck in an infinite loop. Checkout from svn and rebuild, or download the latest off codeplex

Re: Spasm Linux Errors on Bitmaps

Post24 October 2011, 09:37

Works for me :)
Offline
User avatar

NanoWar

Site Admin

Topic Starter

Re: Spasm Linux Errors on Bitmaps

Post24 October 2011, 15:12

Hey, got another one with the seek directive! ;)
Code: Select all
#define TI83P
#include "ti83plus.inc"

      .org $9D95
      .db $BB,$6D
start:
      ld hl, 1234
      bcall(_DispHL)
      bcall(_newLine)
      ret
#define save eval($)
      .seek start
      ret ; crashHere
      .seek save

Code: Select all
Program received signal SIGSEGV, Segmentation fault.
0x0000000000402d54 in write_out (val=123) at pass_one.cpp:66
66          *(out_ptr++) = val;

We can advance the errors only by one at a time it seems. I am trying to compile Wizards which uses tons of file input/output in macros which is where Unix likes to segfault often I guess.
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux Errors on Bitmaps

Post24 October 2011, 18:34

Another sign issue with 64 bit. Fixed, you can checkout and rebuild
Offline
User avatar

NanoWar

Site Admin

Topic Starter

Re: Spasm Linux Errors on Bitmaps

Post24 October 2011, 22:05

I have more :)
Code: Select all
; define a macro
#macro func( func_parameter )
      #ifdef func_parameter
            .echo "defined :)"
      #else
            .echo "undefined :("
      #endif
#endmacro

; wrap it
#define .wrap_func func(

; call them
      func( 1 )
      func()
      .wrap_func 1
      .wrap_func ; # ERROR!
 

Another one:
Code: Select all
      .org 0
start
      .db '0'
save
      .seek start
      .db '1'
      .echo "1 start: ", start
      .echo "1 save: ", save
      .echo "1 exit: ", exit ; # ERROR!
      .seek save
exit
      .echo "2 start: ", start
      .echo "2 save: ", save
      .echo "2 exit: ", exit
 

And:
Code: Select all
#macro func( param )
      #if param = -1
            .echo "Hmm?"
      #endif
      .db param
      .echo param ; # UNEQUAL!
#endmacro

      .db -1
      func(-1)
 


Also the APP signing went wrong again. DIFF on my .bins is successful, on .8xk it's not (comparing to an old build of spasm).
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux Errors on Bitmaps

Post25 October 2011, 03:08

Fixed the app signing as you know. First and third are also fixed, second is expected, you can't forward ref a label from an echo, its evaluated whereever its encountered during the first pass. Committed and released on codeplex

Re: Spasm Linux Errors on Bitmaps

Post25 October 2011, 09:46

At least you are probably going to catch most of the errors :P
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux Errors on Bitmaps

Post25 October 2011, 10:09

I wish, I'm sure there are tons more. And our unit test coverage is absolute crap, to release it just has to assemble Zelda. Too bad unmanaged code in VS doesn't have the nice code coverage features of managed, if so I'd have that it 100% covered.
Offline
User avatar

NanoWar

Site Admin

Topic Starter

Re: Spasm Linux Errors on Bitmaps

Post25 October 2011, 13:14

You could use my example snippets to ensure that they work in coming revisions. You should verify all output, maybe compare binaries also with intel hex...
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux Errors on Bitmaps

Post25 October 2011, 13:34

Oh yeah, we do regression testing for pretty much all broken code, however writing more tests is a pain, especially since VS doesn't support unit tests for C++. And without an analysis of whats covered its hard to motivate myself to figure out what needs covered and write tests to cover it
Offline
User avatar

NanoWar

Site Admin

Topic Starter

Re: Spasm Linux Errors

Post22 November 2011, 16:55

I just downloaded the latest build, and the Wizards output files are again different!

Code: Select all
#macro function(value)
      #ifndef value
            #define value 0
      #endif
      .echo value
#endmacro

#define .function function(

      .echo "Expected: 1"
      .function 1
     
      .echo "Expected: 0"
      .function
 
...does not work anymore (again!).
Code: Select all
crash6.z80:14: Error during invocation of macro '.FUNCTION'
crash6.z80:8: error SE104: Expecting a value, expression ended early
Offline
User avatar

Buckeye Dude

Staff Member

Re: Spasm Linux Errors

Post23 November 2011, 05:28

You're positive you're using the version I fixed? I can't test on linux at the moment but I ran in Windows and it worked fine
Offline
User avatar

NanoWar

Site Admin

Topic Starter

Re: Spasm Linux Errors

Post23 November 2011, 08:16

Yes, sure, I've got my dream build already :)

Return to SPASM

Who is online

Users browsing this forum: No registered users and 1 guest

cron