DEVKIT-MPC5748G c++ GDB server fails

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DEVKIT-MPC5748G c++ GDB server fails

2,159 Views
kfirbs
Contributor III

Hi,

I am using an example C++ project from S32 (hello) for the DEVKIT-MPC5748G.

When I take the project as is, I can compile it and debug it, using the Diab compiler v.5.9.4.8 and the USB debug.

But when adding a class that inherits from another class, and declaring it as global, the debug fails.

pastedImage_2.png

pastedImage_3.png

debugger version: GNU gdb (GDB) 7.8.2

main.cpp, in bold are my additions:

/*
* main implementation: use this 'C++' sample to create your own application
*/

#include "derivative.h" /* include peripheral declarations */
#include "ClassB.h"

#ifdef __cplusplus
extern "C" {
#endif

extern void xcptn_xmpl(void);

#ifdef __cplusplus
}
#endif

ClassB objectB(10);

class counterclass
{
private:
int m_counter;
public:
counterclass(void)
{
m_counter = 0;
};
void increment(void)
{
m_counter++;
};
};

int main()
{
counterclass myccounter;
int mode = 0;
int total = 0;

xcptn_xmpl (); /* Configure and Enable Interrupts */

/* Loop forever */
for(;;) {
myccounter.increment();
}
}

ClassB.cpp

#include "ClassB.h"

ClassB::ClassB(int startValue) :
fStartValue(startValue)
{
}

int ClassB::sum()
{
int sum = fStartValue;
for (int i = 0; i < 4; ++i)
{
sum += i;
}
return sum;

}

ClassA.h:

#ifndef CLASSA_H_
#define CLASSA_H_

class ClassA
{
public:
virtual int sum() = 0;
};

#endif /* CLASSA_H_ */

Can you help me sort out the issue? It seems like a but in S32 debuggger.

** I have attached the example with the addition I have used for reference.#

Labels (1)
Tags (1)
15 Replies

1,578 Views
kfirbs
Contributor III

I have seen an answer from alexanderfedotov‌ 

regarding the addition of -Xdebug-local-cie that for some reason isn't shown here.

It still doesn't work.

0 Kudos

1,578 Views
kfirbs
Contributor III

Hi,

Are there any news regarding the debug problem?

As you can see from my command the debug is with "-Xdebug-dwarf2"

martinkovar

0 Kudos

1,578 Views
kfirbs
Contributor III

Glad to see that it's not only me.

I use the following flags for compiler and linker:

Compiler

dplus -c -tPPCVLEES:simple -I"../include" -IC:/WindRiver/diab/5.9.4.8/PPCVLEEN -I"C:\Freescale\S32_Power_v1.1\eclipse\../S32DS/e200_ewl2/EWL_C/include" -I"C:\Freescale\S32_Power_v1.1\eclipse\../S32DS/e200_ewl2/EWL_C/include/pa" -I"C:\Freescale\S32_Power_v1.1\eclipse\../S32DS/e200_ewl2/EWL_C++/include" -I"C:\Freescale\S32_Power_v1.1\eclipse\../S32DS/e200_ewl2/EWL_C++/include/pa" -Xdebug-struct-all -DMPC5748G -Wa,-Xisa-vle -Xdebug-local-cie -Xdebug-local-all -Xc-new -Xdebug-dwarf2 -Xdialect-ansi -Xframe-info -Xmake-dependency=0x5 -o src/ClassB.o ../src/ClassB.cpp

** With the addition of '-g' for GDB to fail

Linker:

dld -tPPCVLEES:simple -m13 > link.map -Xelf -o testApplicationA.elf ../default.dld ./src/ClassB.o ./src/ClassC.o ./src/func1.o ./src/func2.o ./src/main.o -ld -lc

0 Kudos

1,578 Views
kfirbs
Contributor III

Hi The project can be downloaded from here:

https://drive.google.com/open?id=0B30gLXaoOM3WaGZGVFdDZDlrVTQ 

0 Kudos

1,578 Views
kfirbs
Contributor III

Seems that with GCC the gdb doesn't fail and I can debug my project.

0 Kudos

1,578 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

I cannot download the project from link above, but from your last post it seems, there is something wrong with Diab compiler. Do you use the Diab plugin for S32 Design Studio or you have also IDE from Wind River?

I recommend you to ask Wind River support, maybe they will know about this issue or they will be able to provide you more accurate information.

Regards,

Martin

0 Kudos

1,578 Views
kfirbs
Contributor III

Try now:

hello_me.7z - Google Drive 

I use S32 IDE with the Diab plugin for S32, it seems that the problem originates in GDB and not in Diab compiler since I get an ELF file.

0 Kudos

1,578 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

still not able to download. Please click Use advanced editor while you are writing the answer and attach the project directly to the post.

Regards,

Martin

0 Kudos

1,578 Views
kfirbs
Contributor III

Attached.

0 Kudos

1,578 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

I have two more questions.

1) Is the elf file in the project you attached  compiled by diab or GCC? (I need elf compiled by diab, because I do not have diab license)

2) When you do not use inheritance, does everything work correct?

Regards,

Martin

0 Kudos

1,578 Views
kfirbs
Contributor III

1. You can use the elf in the project, i will add another ELF.

2. Simple class that is found in the source works.

0 Kudos

1,578 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

I found the root cause of your problem and it is called debug symbols. I had tried to load the code including debug symbols and the symptoms were the same as on you side. But when I had disable loading symbols, I was able to download code into the microcontroller.

So, at first, could you please check, if you use debug format DWARF 2.0? Because if you use some higher (3 or 4) it is possible that GDB cannot handle this and unfortunately it seems, there is some unhandled exception which causes GDB crash.

Also, could you please write me back all switches you use for compiling?

Regards,

Martin

1,578 Views
norbertunterber
Contributor II

Hello,

Is there any update to this issue? I am having the same problem, posted some months ago.

See https://community.nxp.com/thread/459823 

Regards

Norbert Unterberg

0 Kudos

1,578 Views
kfirbs
Contributor III

Hi martinkovar‌,

Are there any news regarding this issue?

0 Kudos

1,578 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

could you please attach your project?

The project you tried to debug is compiled by Diab compiler am I correct? Did you try to compile it using GCC? Could you please try and let me know if it works?

Regards,

Martin