Skip to content

Commit a976ed3

Browse files
KONRAD Fredericstsquad
KONRAD Frederic
authored andcommitted
target/m68k: fix gdb for m68xxx
Currently "cf-core.xml" is sent to GDB when using any m68k flavor. Thing is it uses the "org.gnu.gdb.coldfire.core" feature name and gdb 8.3 then expects a coldfire FPU instead of the default m68881 FPU. This is not OK because the m68881 floats registers are 96 bits wide so it crashes GDB with the following error message: (gdb) target remote localhost:7960 Remote debugging using localhost:7960 warning: Register "fp0" has an unsupported size (96 bits) warning: Register "fp1" has an unsupported size (96 bits) ... Remote 'g' packet reply is too long (expected 148 bytes, got 180 bytes): \ 00000000000[...]0000 With this patch: qemu-system-m68k -M none -cpu m68020 -s -S (gdb) tar rem :1234 Remote debugging using :1234 warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. 0x00000000 in ?? () (gdb) p $fp0 $1 = nan(0xffffffffffffffff) Signed-off-by: KONRAD Frederic <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Reviewed-by: Laurent Vivier <[email protected]> Message-Id: <[email protected]> Message-Id: <[email protected]>
1 parent df3ca22 commit a976ed3

File tree

3 files changed

+67
-16
lines changed

3 files changed

+67
-16
lines changed

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -7825,7 +7825,7 @@ case "$target_name" in
78257825
;;
78267826
m68k)
78277827
bflt="yes"
7828-
gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
7828+
gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml"
78297829
TARGET_SYSTBL_ABI=common
78307830
;;
78317831
microblaze|microblazeel)

gdb-xml/m68k-core.xml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<!-- Copyright (C) 2008 Free Software Foundation, Inc.
3+
4+
Copying and distribution of this file, with or without modification,
5+
are permitted in any medium without royalty provided the copyright
6+
notice and this notice are preserved. -->
7+
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
8+
<feature name="org.gnu.gdb.m68k.core">
9+
<reg name="d0" bitsize="32"/>
10+
<reg name="d1" bitsize="32"/>
11+
<reg name="d2" bitsize="32"/>
12+
<reg name="d3" bitsize="32"/>
13+
<reg name="d4" bitsize="32"/>
14+
<reg name="d5" bitsize="32"/>
15+
<reg name="d6" bitsize="32"/>
16+
<reg name="d7" bitsize="32"/>
17+
<reg name="a0" bitsize="32" type="data_ptr"/>
18+
<reg name="a1" bitsize="32" type="data_ptr"/>
19+
<reg name="a2" bitsize="32" type="data_ptr"/>
20+
<reg name="a3" bitsize="32" type="data_ptr"/>
21+
<reg name="a4" bitsize="32" type="data_ptr"/>
22+
<reg name="a5" bitsize="32" type="data_ptr"/>
23+
<reg name="fp" bitsize="32" type="data_ptr"/>
24+
<reg name="sp" bitsize="32" type="data_ptr"/>
25+
26+
<reg name="ps" bitsize="32"/>
27+
<reg name="pc" bitsize="32" type="code_ptr"/>
28+
29+
</feature>

target/m68k/cpu.c

+37-15
Original file line numberDiff line numberDiff line change
@@ -292,16 +292,38 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
292292
cc->tcg_initialize = m68k_tcg_init;
293293

294294
cc->gdb_num_core_regs = 18;
295-
cc->gdb_core_xml_file = "cf-core.xml";
296295

297296
dc->vmsd = &vmstate_m68k_cpu;
298297
}
299298

300-
#define DEFINE_M68K_CPU_TYPE(cpu_model, initfn) \
301-
{ \
302-
.name = M68K_CPU_TYPE_NAME(cpu_model), \
303-
.instance_init = initfn, \
304-
.parent = TYPE_M68K_CPU, \
299+
static void m68k_cpu_class_init_cf_core(ObjectClass *c, void *data)
300+
{
301+
CPUClass *cc = CPU_CLASS(c);
302+
303+
cc->gdb_core_xml_file = "cf-core.xml";
304+
}
305+
306+
#define DEFINE_M68K_CPU_TYPE_CF(model) \
307+
{ \
308+
.name = M68K_CPU_TYPE_NAME(#model), \
309+
.instance_init = model##_cpu_initfn, \
310+
.parent = TYPE_M68K_CPU, \
311+
.class_init = m68k_cpu_class_init_cf_core \
312+
}
313+
314+
static void m68k_cpu_class_init_m68k_core(ObjectClass *c, void *data)
315+
{
316+
CPUClass *cc = CPU_CLASS(c);
317+
318+
cc->gdb_core_xml_file = "m68k-core.xml";
319+
}
320+
321+
#define DEFINE_M68K_CPU_TYPE_M68K(model) \
322+
{ \
323+
.name = M68K_CPU_TYPE_NAME(#model), \
324+
.instance_init = model##_cpu_initfn, \
325+
.parent = TYPE_M68K_CPU, \
326+
.class_init = m68k_cpu_class_init_m68k_core \
305327
}
306328

307329
static const TypeInfo m68k_cpus_type_infos[] = {
@@ -314,15 +336,15 @@ static const TypeInfo m68k_cpus_type_infos[] = {
314336
.class_size = sizeof(M68kCPUClass),
315337
.class_init = m68k_cpu_class_init,
316338
},
317-
DEFINE_M68K_CPU_TYPE("m68000", m68000_cpu_initfn),
318-
DEFINE_M68K_CPU_TYPE("m68020", m68020_cpu_initfn),
319-
DEFINE_M68K_CPU_TYPE("m68030", m68030_cpu_initfn),
320-
DEFINE_M68K_CPU_TYPE("m68040", m68040_cpu_initfn),
321-
DEFINE_M68K_CPU_TYPE("m68060", m68060_cpu_initfn),
322-
DEFINE_M68K_CPU_TYPE("m5206", m5206_cpu_initfn),
323-
DEFINE_M68K_CPU_TYPE("m5208", m5208_cpu_initfn),
324-
DEFINE_M68K_CPU_TYPE("cfv4e", cfv4e_cpu_initfn),
325-
DEFINE_M68K_CPU_TYPE("any", any_cpu_initfn),
339+
DEFINE_M68K_CPU_TYPE_M68K(m68000),
340+
DEFINE_M68K_CPU_TYPE_M68K(m68020),
341+
DEFINE_M68K_CPU_TYPE_M68K(m68030),
342+
DEFINE_M68K_CPU_TYPE_M68K(m68040),
343+
DEFINE_M68K_CPU_TYPE_M68K(m68060),
344+
DEFINE_M68K_CPU_TYPE_CF(m5206),
345+
DEFINE_M68K_CPU_TYPE_CF(m5208),
346+
DEFINE_M68K_CPU_TYPE_CF(cfv4e),
347+
DEFINE_M68K_CPU_TYPE_CF(any),
326348
};
327349

328350
DEFINE_TYPES(m68k_cpus_type_infos)

0 commit comments

Comments
 (0)