Page 1 of 1

Spasm Linux Errors

PostPosted: 12 October 2011, 09:15
by NanoWar
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)

Re: Spasm Linux

PostPosted: 17 October 2011, 10:44
by Buckeye Dude
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.

Re: Spasm Linux

PostPosted: 17 October 2011, 12:23
by NanoWar
It segfaults on any bitmap inclusion. Trivial example is in the attachment.

Re: Spasm Linux

PostPosted: 19 October 2011, 18:56
by Buckeye Dude
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 :/

Re: Spasm Linux

PostPosted: 20 October 2011, 15:33
by NanoWar
How do you professionally debug a C program in Linux? I dont think GDB command line is any fun...

Re: Spasm Linux

PostPosted: 24 October 2011, 03:08
by Eeems
You could use an IDE I would think. Eclipse and KDevelop are two good ones.

Re: Spasm Linux Errors on Bitmaps

PostPosted: 24 October 2011, 03:58
by Buckeye Dude
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.

Re: Spasm Linux Errors on Bitmaps

PostPosted: 24 October 2011, 08:44
by Buckeye Dude
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

PostPosted: 24 October 2011, 09:37
by Eeems
Works for me :)

Re: Spasm Linux Errors on Bitmaps

PostPosted: 24 October 2011, 15:12
by NanoWar
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.

Re: Spasm Linux Errors on Bitmaps

PostPosted: 24 October 2011, 18:34
by Buckeye Dude
Another sign issue with 64 bit. Fixed, you can checkout and rebuild

Re: Spasm Linux Errors on Bitmaps

PostPosted: 24 October 2011, 22:05
by NanoWar
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).

Re: Spasm Linux Errors on Bitmaps

PostPosted: 25 October 2011, 03:08
by Buckeye Dude
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

PostPosted: 25 October 2011, 09:46
by Eeems
At least you are probably going to catch most of the errors :P

Re: Spasm Linux Errors on Bitmaps

PostPosted: 25 October 2011, 10:09
by Buckeye Dude
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.

Re: Spasm Linux Errors on Bitmaps

PostPosted: 25 October 2011, 13:14
by NanoWar
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...

Re: Spasm Linux Errors on Bitmaps

PostPosted: 25 October 2011, 13:34
by Buckeye Dude
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

Re: Spasm Linux Errors

PostPosted: 22 November 2011, 16:55
by NanoWar
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

Re: Spasm Linux Errors

PostPosted: 23 November 2011, 05:28
by Buckeye Dude
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

Re: Spasm Linux Errors

PostPosted: 23 November 2011, 08:16
by NanoWar
Yes, sure, I've got my dream build already :)