|
|
View previous topic :: View next topic |
Author |
Message |
dcm684
Joined: 08 Sep 2010 Posts: 8
|
Debugging in MPLAB X - Can only set breakpoints some places |
Posted: Fri May 31, 2019 2:33 pm |
|
|
I am trying to figure out why I can only set breakpoints on part of my program in MPLAB X. For the first 1/3 of of the program, I can click in the sidebar and get a working breakpoint. If I try to set it elsewhere, I get the error "Break point at line 63 in file ......... cannot be resolved to a valid program memory address."
Here's what I have picked up thus far in my search to resolve this:
I can set an address break point for the function through MPLAB. Instead of breaking on a line, I can break at that address, but this is inefficient as I have to check the lst file every time I compile. Reading the ASM code shows me that the code is not being optimized away.
When the address break point is triggered the "Call Stack" window indicates that the breakpoint occurred in the function I wanted to and the line I wanted to, but not the file. It shows "foo() at C:/wrong_file.c:41" where foo() is the desired name and 41 is the correct line, but instead of referencing "right_file.c" it has "wrong_file.c".
When I look at the lst file, all of the "c" code that I can break on looks fine. BUT when I look at the lines where I cannot they all end in " 1" as in space char one. This is the case for all lines from "c" and "h" files alike. Both code and comments. For example:
Code: |
.................... /** 1
.................... * Sets a pin to a given state 1
.................... */ 1
.................... SET_BIT(tempValue, theBit); 1 |
The other thing to note is that this is a large project. I used the PCH (non-IDE) compiler, so I have to #include all of my ".c" files, all 85 of them. Then another 95 header files. The issue seems to be related to the order of #includes. It happens about 90 includes after the start of the lst file. If I include "fileWithBreakpoint.c" before "otherFile.h" everything works fine. But if I put "fileWithBreakpoint.c" after "otherFile.h," the breakpoint won't work. If I deleted everything out of "otherFile.h" but leave the include, it all works again, but if I just comment everything out in it, it will not work. In either case the files included afterwards cannot have their breakpoints set.
Headers may be included by multiple files, but their contents are only included once thru the #ifndef XXXX_H #define XXXX_H method.
Has anyone had this issue before? How did you fix it? What does the "{space char} 1" line endings mean in the lst file? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri May 31, 2019 3:19 pm |
|
|
In this Microchip forum thread, the administrator "Annapolis" says this
can be caused by using different editors (on your 85 files) which put
different line ending characters at the ends of lines:
https://www.microchip.com/forums/m573178.aspx |
|
|
dcm684
Joined: 08 Sep 2010 Posts: 8
|
|
Posted: Fri May 31, 2019 8:23 pm |
|
|
Thanks PCM. There was a mix of line endings, which are now fixed (and will be kept in check through a precompile script calling AStyle). Unfortunately, I'm still running into the same problems.
Break point on the lines in the listing file that end with the '1' put in there by the compiler still do not work. It seems like the first 80 or so included files (h and c) are fine, but any after that it gets mixed up. Listing lines start getting '1' added. The call stack window starts showing the wrong file. Etc. |
|
|
|
|
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
|