CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

The program file could not be loaded: Index: 0, Size: 0

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lucromain



Joined: 04 Apr 2011
Posts: 9

View user's profile Send private message

The program file could not be loaded: Index: 0, Size: 0
PostPosted: Tue May 05, 2026 7:16 pm     Reply with quote

This issue seems to have been reported by https://www.ccsinfo.com/forum/viewtopic.php?t=58059 several years ago, but I am getting the same error with newer versions of MPLAB X and CCS.

I'm running MPLAB X version 6.15 on Ubuntu Linux 25.10.
Running CCS v5.123

When pressing the "Debug" icon, it usually works the first time after starting mplab x. However, if I stop the simulator, recompile and then try to restart the debugger, compilation always succeeds, but then I get this error:
Code:

BUILD SUCCESSFUL (total time: 670ms)
Loading symbols from /home/luc/MPLABXProjects/ToneBoard.X/dist/default/debug/ToneBoard.X.debug.cof...
The program file could not be loaded: Index: 0, Size: 0


That error also appears when clicking on the "Cleanup & Build" icon. If I click multiple times on the "Cleanup & Build", the error eventually goes away and I can launch the debugger again.

I suspect a Linux/Ubuntu specific issue with MPLAB X / CCS compiler.

I also tried different versions of MPLAB X (6.30, 6.20, 6.15, 6.05, 6.00) and they all exhibit the same problem.

Is this a know issue or solutions available?
Ttelmah



Joined: 11 Mar 2010
Posts: 20075

View user's profile Send private message

PostPosted: Tue May 05, 2026 10:08 pm     Reply with quote

it sounds to me like a permission issue.
I suggest you ask CCS themselves. Very few Unix/Linus users, and
your particular configuration will probably be unique.
Suggest though you just try changing the permissions on the working
directory so that everybody has read and write permissions here, and
see if that helps.
lucromain



Joined: 04 Apr 2011
Posts: 9

View user's profile Send private message

Analysis - Enum caused incorrect .cof file symbols
PostPosted: Thu May 07, 2026 7:00 pm     Reply with quote

I root cause the problem and now able to run debug successfully, including breakpoints and watches. I'm using MPLAB X v6.15.

In MPLAB X version v6.30, there are issues with breakpoints. The debugger does not stop on breakpoints. Therefore version v6.15 is what I'll keep using going forward.

I used ChatGPT to analyze the .cof file. Here are the results:

Findings

I inspected the generated .cof file and found that the symbol table is structurally present and contains expected symbols, but enum constants appear to be emitted with suspicious COFF metadata.

Problematic source:

enum state_enum {
idle,
tone_start,
tone_on,
tone_tail,
};

In the COFF symbol table, these enum members appear as consecutive symbol entries with:

storage class = 0x10
aux count (n_numaux) = 0xB8 (184)

Example decoded entries:

idle class=0x10 numaux=184
tone_start class=0x10 numaux=184
tone_on class=0x10 numaux=184
tone_tail class=0x10 numaux=184

This aux count appears invalid or nonstandard.

MPLAB X seems to interpret these as standard COFF symbol entries and attempts to read 184 auxiliary records, which likely causes the parser to walk past the symbol table bounds and crash.

Reproduction
Define a global enum like:
enum state_enum {
idle,
tone_start,
tone_on,
tone_tail,
};
Build with debug output enabled (.cof).
Open in MPLAB X debugger/simulator.
Watch window fails to populate or disappears; MPLAB may throw a CoffReaderC18.BuildSymbolTable exception.

Workaround

Replacing the enum with preprocessor constants avoids the issue:

#define STATE_IDLE 0
#define STATE_TONE_START 1
#define STATE_TONE_ON 2
#define STATE_TONE_TAIL 3

int8 state;

With this change, debugger watch symbols behave normally.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group