English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 23 September 2016, 02:18   #1
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,438
Puzzling visits of the Guru with Cubic IDE, vbcc 0.8, on ACA1230

Hi all!

I am facing a puzzling (and frustrating! ) problem while developing with Cubic IDE, vbcc 0.8 on an Amiga 1200. I used to have a Blizzard 1240 and my code would compile and run fine (see AmiModRadio).

Then, I had to replace (temporarily!) my 1240 with an ACA1230 and, boom , the same code, compiled the same way, crashes at random places when run... with a variety of Gurus (8000 0004, 8000 0003, 0100 0003...)

As far as I understand, my makefile and options do not precise any processor... so what could happen?

(AmiModRadio uses Miami and MUI, which both run fine with the ACA1230.)

Any help/suggestion are welcome before I
Thanks!
tygre is offline  
Old 23 September 2016, 16:37   #2
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,547
Are you sure your development environment didn't change? Or did you work on the source in the meantime?

Do you still have old object files compiled with the B1240? I would try to isolate the problem by comparing them with the new objects.

Best would be to generate assembler output with both cards (-S option) and compare the sources.
phx is offline  
Old 23 September 2016, 17:23   #3
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,438
Thanks PHX!

Yes, I am sure that I did not change my code before starting to receive these random visits... Also, they are quite random, pointing at various locations in my code as far as I understand...

Yes, I have back-up'ed the object files although I am not sure their dates and I did not use the -S option.

What could I do to understand (and fix!) these visits?
tygre is offline  
Old 23 September 2016, 22:49   #4
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,547
Currently I have no idea what could be causing your problems, except a hardware problem or software mis-configuration of your ACA1230. But then you would probably see strange effects in other areas of the system as well.

Did you already try different optimization levels? With optimizations enabled vbcc may use a lot of memory. Maybe this involves (defective) RAM-regions which are otherwise not touched by most programs.

When you still have a backuped B1240-compiled object file from a source text, which was not modified since then, so compare it with the new object. Either by using a simple "cmp"-tool (Aminet) or by reassembling (ReSource, IRA, ADis, etc.) the objects and comparing the reassembled source (with a diff-like tool).
phx is offline  
Old 25 September 2016, 23:13   #5
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,438
Hi PHX!

Some good news and some questions...

The good news is that, after putting back my Blizzard 1240, my code compiles and runs as expected (and when it crashes, it is consistent, I can find why, and I can fix it ), hoorey!

The questions is: what could be different between having the Blizzard 1240 and the ACA1230 that the same program would run fine with the former and crash randomly with the latter?

I have checked that I using the "standard" math library from my original Workbench 3.1 disk, same for RexxMast, same for MUI... Yet, sometimes the Gurus talks about FPU...

Any ideas?

PS. You can find the makefile here and the options here...

Last edited by tygre; 25 September 2016 at 23:22. Reason: More info.
tygre is offline  
Old 26 September 2016, 12:25   #6
zero
Registered User
 
Join Date: Jun 2016
Location: UK
Posts: 428
MOD playback code uses interrupts and the FPU perhaps?
zero is offline  
Old 26 September 2016, 16:40   #7
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,438
Hi Zero!

It should not because I am actually using AREXX to use an existing player, for example HippoPlayer, which works fine independently of AmiModRadio...

Puzzling, eh
tygre is offline  
Old 27 September 2016, 13:17   #8
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,547
What are you doing with the FPU in your program?

In fact, the 68882 FPU is different to the internal 68040 FPU. Maybe you compiled for 68040-FPU and/or linked with m040.lib? I have no experience with CubicIDE, and I haven't seen any options in your Makefile or project.options file which specify CPU type or math libraries.

So in case you didn't specify any -fpu=68882 or -fpu=68040 option, then the compiler will generate code to use the AmigaOS mathieee-libraries. This also includes the mathieeesingbas.library, which has some known bugs under OS3.1 with 68040 and 68060 FPUs.

I probably don't have to mention that vbcc 0.8 may be 10 years old (depending on the version used in CubicIDE). Which doesn't mean that it doesn't work, but there were quite a lot of bug fixes since then.
phx is offline  
Old 27 September 2016, 18:45   #9
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,438
Hi PHX!

Actually, I don't do any FPU-related computations... all the more puzzling! Could there be a way to inspect the object files or executable to identify possible illegal calls?

I like Cubic IDE and vbcc but I am opened to alternatives? Could you suggest me any?

Cheers!
tygre is offline  
Old 27 September 2016, 20:31   #10
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,547
Quote:
Originally Posted by tygre View Post
Could there be a way to inspect the object files or executable to identify possible illegal calls?
You can reassemble or disassemble them.

When running MungWall and Enforcer (or MuForce from the MuTools) you can identify the crash location or any illegal access. It will show you the offset into a section, which you could possibly translate into a source name and line number with a FindHit-like tool, provided that you compiled the program with LINE-debug hunks (vbcc -hunkdebug option, or just -g in newer 0.9 versions). Or look for the offset in your reassembled source.

But first of all you should make sure that the program and object files generated by the compiler on an ACA1230 are the same as on a B1260. Did you already confirm that? It didn't became clear in your last postings.


Quote:
I like Cubic IDE and vbcc but I am opened to alternatives? Could you suggest me any?
The latest vbcc 0.9e is here: http://sun.hasenbraten.de/vbcc/
But I don't know if you can simply update it inside Cubic IDE. You may have to switch to a command-line approach and write a Makefile yourself.
phx is offline  
Old 27 September 2016, 23:19   #11
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 763
I used to use cubic ide with VBCC and I updated VBCC by simply replacing files.
tolkien is online now  
Old 27 September 2016, 23:49   #12
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by tygre View Post
I like Cubic IDE and vbcc but I am opened to alternatives? Could you suggest me any?
I doubt the problem is vbcc. Consider checking your memory, checking for viruses and removing hacks and patches temporarily. If upgrading vbcc to the newest version, it is going to be easier than installing GCC.

Quote:
Originally Posted by phx View Post
You can reassemble or disassemble them.

When running MungWall and Enforcer (or MuForce from the MuTools) you can identify the crash location or any illegal access. It will show you the offset into a section, which you could possibly translate into a source name and line number with a FindHit-like tool, provided that you compiled the program with LINE-debug hunks (vbcc -hunkdebug option, or just -g in newer 0.9 versions). Or look for the offset in your reassembled source.
Why not link to your FindHunkOffset?

http://sun.hasenbraten.de/~frank/pro...HunkOffset.lha

It works here and is more reliable across compiler versions than GCCFindHit. Why Amiga 68k installations do not have it installed in the bin directory I do not know.

Quote:
Originally Posted by phx View Post
But first of all you should make sure that the program and object files generated by the compiler on an ACA1230 are the same as on a B1260. Did you already confirm that? It didn't became clear in your last postings.
Good advice.
matthey is offline  
Old 29 September 2016, 15:20   #13
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,438
Dear Phx, Tolkien, and Matthey!

Thank you for all your kind advices!

I will make the time during the week-end to follow them and will keep you posted... Beware that I am still learning so I may bother you with silly/newbie questions about disassembling and hunks and offsets...

Talk to you soon!
tygre is offline  
Old 24 October 2016, 23:53   #14
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,438
Dear all!

So, I finally took the time to debug this problem and, beside a few bugs in my code that were easy to fix, the main problem was the stack!?

Just by setting the stack to 32768 (instead of the default 4096), AmiModRadio works well

I looked around but could not find code to check and increase the stack size, would you have any pointers to share about checking/increasing the stack programmatically in C?

Cheers!
tygre is offline  
Old 26 October 2016, 18:01   #15
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by tygre View Post
So, I finally took the time to debug this problem and, beside a few bugs in my code that were easy to fix, the main problem was the stack!?

Just by setting the stack to 32768 (instead of the default 4096), AmiModRadio works well
Simple but deadly mistake. I increase the stack size for my shells which helps when running more modern shell launched programs.

Quote:
Originally Posted by tygre View Post
I looked around but could not find code to check and increase the stack size, would you have any pointers to share about checking/increasing the stack programmatically in C?
Read The Manual (RTM) section 12.4.3.

http://server.owl.de/~frank/vbcc/docs/vbcc.pdf

It should be easy to increase the stack size as described with "size_t __stack=32768;". Unless you have a program which uses more stack size when processing more data, it is best to avoid the -stack-check option. Scout will show the amount of stack used by tasks.
matthey is offline  
Old 27 October 2016, 02:40   #16
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,438
Hi Matthey!

Quote:
Originally Posted by matthey View Post
Read The Manual (RTM) section 12.4.3.

http://server.owl.de/~frank/vbcc/docs/vbcc.pdf

It should be easy to increase the stack size as described with "size_t __stack=32768;". Unless you have a program which uses more stack size when processing more data, it is best to avoid the -stack-check option. Scout will show the amount of stack used by tasks.
Ah, thank you so much, indeed I should RTFM

Cheers!

PS. Could a kind moderator mark this thread as "solved"?
tygre is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vbcc IDE iliak Coders. C/C++ 23 23 April 2019 17:27
[Solved] Puzzling problem with FTPd tygre support.Apps 3 22 March 2013 21:45
Cubic Dream in WinUAE thor support.WinUAE 9 21 January 2007 14:50
Software News : C/C++ update for Cubic IDE Paul News 0 17 June 2006 13:17
Intelligent Fun:Cubic + Tygard NOB HOL contributions 0 07 January 2006 14:21

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:55.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09427 seconds with 13 queries