|
From: | KONRAD Frederic |
Subject: | Re: [PATCH v1] target/m68k: fix gdb for m68xxx |
Date: | Tue, 21 Apr 2020 11:47:44 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Le 4/20/20 à 10:43 PM, Laurent Vivier a écrit :
Le 20/04/2020 à 21:08, KONRAD Frederic a écrit :Le 4/20/20 à 5:46 PM, Laurent Vivier a écrit :Le 20/04/2020 à 16:01, address@hidden a écrit :From: KONRAD Frederic <address@hidden> 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.I checked in gdb sources and there is no cf definition. Moreover if I change only the cf to m68k in QEMU it seems to work in both cases: diff --git a/gdb-xml/cf-core.xml b/gdb-xml/cf-core.xml index b90af3042c..5b092d26de 100644 --- a/gdb-xml/cf-core.xml +++ b/gdb-xml/cf-core.xml @@ -5,7 +5,7 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> <!DOCTYPE feature SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.coldfire.core"> +<feature name="org.gnu.gdb.m68k.core"> <reg name="d0" bitsize="32"/> <reg name="d1" bitsize="32"/> <reg name="d2" bitsize="32"/>Doesn't that break gdb with coldfire?diff --git a/gdb-xml/m68k-fp.xml b/gdb-xml/m68k-fp.xml index 64290d1630..0ef74f7488 100644 --- a/gdb-xml/m68k-fp.xml +++ b/gdb-xml/m68k-fp.xml @@ -5,7 +5,7 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> <!DOCTYPE feature SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.coldfire.fp"> +<feature name="org.gnu.gdb.m68k.fp"> <reg name="fp0" bitsize="96" type="float" group="float"/> <reg name="fp1" bitsize="96" type="float" group="float"/> <reg name="fp2" bitsize="96" type="float" group="float"/> As I have not checked the gdb sources for that, I'd like to have your opinion.In the GDB 8.3 sources: m68k-tdep.c:1091: feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.m68k.core"); if (feature == NULL) { feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.coldfire.core"); if (feature != NULL) flavour = m68k_coldfire_flavour; } Hence the change I suggested. Little later it has also: feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.coldfire.fp"); if (feature != NULL) { valid_p = 1; for (i = M68K_FP0_REGNUM; i <= M68K_FPI_REGNUM; i++) valid_p &= tdesc_numbered_register (feature, tdesc_data, i, m68k_register_names[i]); if (!valid_p) { tdesc_data_cleanup (tdesc_data); return NULL; } } else has_fp = 0; Which is why I didn't made the change you suggested about the m68k-fp.xml but I just tried with this additional change and it doesn't seem to hurt.Thank you for your analysis, it seems a simpler patch works with coldfire and m68k.
Hi Laurent, Arg sorry I though I said that in an other email but apparently I forgot to hit the send button. The issue with this simpler patch is that GDB will not set: flavour = m68k_coldfire_flavour when we are running coldfire emulation, and that might break the ABI within GDB. According to the comments there, float are returned within D0 for ColdFire and not the other one. That's why I cared to keep them separate ie: send the right "feature name" for the right cpu we are modelling.
diff --git a/configure b/configure index 23b5e93752..b3be6d9c4b 100755 --- a/configure +++ b/configure @@ -7825,7 +7825,7 @@ case "$target_name" in ;; m68k) bflt="yes" - gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml" + gdb_xml_files="m68k-core.xml cf-fp.xml m68k-fp.xml" TARGET_SYSTBL_ABI=common ;; microblaze|microblazeel) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 9445fcd6df..4e942a0a8e 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -292,7 +292,7 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data) cc->tcg_initialize = m68k_tcg_init; cc->gdb_num_core_regs = 18; - cc->gdb_core_xml_file = "cf-core.xml"; + cc->gdb_core_xml_file = "m68k-core.xml"; dc->vmsd = &vmstate_m68k_cpu; } diff --git a/gdb-xml/cf-core.xml b/gdb-xml/m68k-core.xml similarity index 96% rename from gdb-xml/cf-core.xml rename to gdb-xml/m68k-core.xml index b90af3042c..5b092d26de 100644 --- a/gdb-xml/cf-core.xml +++ b/gdb-xml/m68k-core.xml @@ -5,7 +5,7 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> <!DOCTYPE feature SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.coldfire.core"> +<feature name="org.gnu.gdb.m68k.core"> <reg name="d0" bitsize="32"/> <reg name="d1" bitsize="32"/> <reg name="d2" bitsize="32"/> diff --git a/gdb-xml/m68k-fp.xml b/gdb-xml/m68k-fp.xml index 64290d1630..0ef74f7488 100644 --- a/gdb-xml/m68k-fp.xml +++ b/gdb-xml/m68k-fp.xml @@ -5,7 +5,7 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> <!DOCTYPE feature SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.coldfire.fp"> +<feature name="org.gnu.gdb.m68k.fp"> <reg name="fp0" bitsize="96" type="float" group="float"/> <reg name="fp1" bitsize="96" type="float" group="float"/> <reg name="fp2" bitsize="96" type="float" group="float"/> I have tested with both architectures: * -M q800: (gdb) info float fp0 nan(0xffffffffffffffff) (raw 0x7fff0000ffffffffffffffff) fp1 nan(0xffffffffffffffff) (raw 0x7fff0000ffffffffffffffff) fp2 nan(0xffffffffffffffff) (raw 0x7fff0000ffffffffffffffff) fp3 nan(0xffffffffffffffff) (raw 0x7fff0000ffffffffffffffff) fp4 nan(0xffffffffffffffff) (raw 0x7fff0000ffffffffffffffff) fp5 nan(0xffffffffffffffff) (raw 0x7fff0000ffffffffffffffff) fp6 nan(0xffffffffffffffff) (raw 0x7fff0000ffffffffffffffff) fp7 nan(0xffffffffffffffff) (raw 0x7fff0000ffffffffffffffff) fpcontrol 0x0 0 fpstatus 0x0 0 fpiaddr 0x0 0x0 (gdb) info registers d0 0x0 0 d1 0x2 2 d2 0x462a0 287392 d3 0x40 64 d4 0x0 0 d5 0x0 0 d6 0x0 0 d7 0x0 0 a0 0x3e0000 0x3e0000 a1 0x3e351c 0x3e351c a2 0x3e351c 0x3e351c a3 0x3e0000 0x3e0000 a4 0x46390 0x46390 a5 0x2eed7e 0x2eed7e fp 0x2c65c 0x2c65c sp 0x3e1fa4 0x3e1fa4 ps 0x2000 8192 pc 0x2f00 0x2f00 fpcontrol 0x0 0 fpstatus 0x0 0 fpiaddr 0x0 0x0 * -cpu cfv4e (gdb) info registers d0 0x0 0 d1 0x401c0b40 1075579712 d2 0x0 0 d3 0x0 0 d4 0x0 0 d5 0x0 0 d6 0x0 0 d7 0x0 0 a0 0x4015c008 0x4015c008 a1 0x40151092 0x40151092 a2 0x401146c8 0x401146c8 a3 0x4016b189 0x4016b189 a4 0x400ac60a 0x400ac60a a5 0x40017078 0x40017078 fp 0x4015cff8 0x4015cff8 sp 0x4015cfcc 0x4015cfcc ps 0x2000 8192 pc 0x40010a2a 0x40010a2a fpcontrol 0x0 0 fpstatus 0x0 0 fpiaddr 0x0 0x0 (gdb) info float fp0 nan(0xfffffffffffff) (raw 0x7fffffffffffffff) fp1 nan(0xfffffffffffff) (raw 0x7fffffffffffffff) fp2 nan(0xfffffffffffff) (raw 0x7fffffffffffffff) fp3 nan(0xfffffffffffff) (raw 0x7fffffffffffffff) fp4 nan(0xfffffffffffff) (raw 0x7fffffffffffffff) fp5 nan(0xfffffffffffff) (raw 0x7fffffffffffffff) fp6 nan(0xfffffffffffff) (raw 0x7fffffffffffffff) fp7 nan(0xfffffffffffff) (raw 0x7fffffffffffffff) fpcontrol 0x0 0 fpstatus 0x0 0 fpiaddr 0x0 0x0 All with a native GDB from debian/sid (GNU gdb (Debian 9.1-3) 9.1). Thanks, Laurent
[Prev in Thread] | Current Thread | [Next in Thread] |