Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Question: CDT Debugging on x86_64

Hi, 

I've been working on porting eclipse to 64 bit platforms. Currently I am
experiencing the problem that the CDT debug configurations dialog claims
that there is no debugger available, although debugging works just fine
(after a simple fix that I've sent to the cdt-patch list). I believe the
problem is in: 
org.eclipse.cdt.launch.ui.CDebuggerTab.loadDebuggerComboBox(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String) at CDebuggerTab.java:134
	programCPU = bin.getCPU();

which returns: 'java.lang.String "none"' on x86_64 but 
returns: 'java.lang.String "x86"' on i386.


I've traced this problem down to the following code snippet in
org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/Elf.java:

<snip>
               switch (ehdr.e_machine) {
                        case Elf.ELFhdr.EM_386 :
                        case Elf.ELFhdr.EM_486 :
                                attrib.cpu = new String("x86");
                                break;
                        case Elf.ELFhdr.EM_PPC :
                                attrib.cpu = new String("ppc");
                                break;
                        case Elf.ELFhdr.EM_SH :
                                attrib.cpu = new String("sh");
                                break;
                        case Elf.ELFhdr.EM_ARM :
                                attrib.cpu = new String("arm");
                                break;
                        case Elf.ELFhdr.EM_MIPS_RS3_LE :
                        case Elf.ELFhdr.EM_MIPS :
                        case Elf.ELFhdr.EM_RS6000 :
                                attrib.cpu = "mips";
                                break;
                        case Elf.ELFhdr.EM_SPARC32PLUS:
                        case Elf.ELFhdr.EM_SPARC:
                                attrib.cpu = "sparc";
                                break;
                        case Elf.ELFhdr.EM_68K:
                                attrib.cpu = "m68k";
                                break;
                        case Elf.ELFhdr.EM_NONE:
                        default:
                                attrib.cpu = "none";
                }
</snip>

Where there is no definition for X86_64 or IA64 architectures. Was this
done intentionally or was it left out by mistake assuming that eclipse
(and the CDT) will not be used on 64 bit machines? 

Can I just go ahead and add in the definitions for X86_64 and IA64? In
which case what are the values of e_machines for those 2 architectures
defined in the same file?

<snip>
               /* values of e_machine */
                public final static int EM_NONE = 0;
                public final static int EM_M32 = 1;
                public final static int EM_SPARC = 2;
                public final static int EM_386 = 3;
                public final static int EM_68K = 4;
                public final static int EM_88K = 5;
                public final static int EM_486 = 6;
                public final static int EM_860 = 7;
                public final static int EM_MIPS = 8;
                public final static int EM_MIPS_RS3_LE = 10;
                public final static int EM_RS6000 = 11;
                public final static int EM_PA_RSIC = 15;
                public final static int EM_nCUBE = 16;
                public final static int EM_VPP500 = 17;
                public final static int EM_SPARC32PLUS = 18;
                public final static int EM_PPC = 20;
                public final static int EM_ARM = 40;
                public final static int EM_SH = 42;
</snip>

Are there other changes that need to be made?

I appreciate any assistance with this.


Peter Faltaous






Back to the top