Thanks for the information.

There are unofficial patches to both gcc and gdb to support 6809.  Neither of 
them support DWARF.

As you said, MAME could in theory just come up with a register mapping, and 
compiler writers (e.g., CMOC for 6809) would have to adhere to that mapping to 
be compatible with MAME.  And we'd definitely want to publish that mapping.  It 
would need to be published somewhere obvious and official enough that others 
would find it--even if MAME is not their target scenario.  For example, if gcc 
or gdb decided to officially support 6809 years later, MAME would be in a tough 
spot if they chose a different mapping.

Might it be possible for someone to publish register mappings for CPUs without 
ABIs somewhere on https://dwarfstd.org/?

Or, are there ways to write custom tags into DWARF to identify it as a 
"MAME-compatible", so MAME could detect when the register mapping is compatible?


Thanks again for your help!
David

From: John DelSignore <jdelsign...@perforce.com>
Sent: Monday, May 5, 2025 4:07 AM
To: David Broman <davbrda...@hotmail.com>; dwarf-discuss@lists.dwarfstd.org
Cc: John DelSignore <jdelsign...@perforce.com>
Subject: RE: DWARF on vintage CPUs

Hi David,

There's no standard ABI document (that I could find). You might want to look in 
the GDB sources on the off chance that it supported at some point.

Ultimately, the thing that matters is how the compilers you are using numbers 
the registers. There is a decent description of the microprocessor here: 
https://en.wikipedia.org/wiki/Motorola_6809, which contains as model of the 
registers here: https://en.wikipedia.org/wiki/File:6809_Internal_Registers.svg. 
It's up to the compilers, but the numbering of the registers might be something 
like: D=0, A=1, B=2, X=3, Y=5, U=6, S=7, PC=8, DP=9, and CC=10. So, for 
example, when you see register 6 in the DWARF, you'll know it's register U. And 
whatever numbering you pick, you should publish it somewhere so that others can 
know the register numbering you picked.

Cheers, John D.


From: Dwarf-discuss 
<dwarf-discuss-bounces~jdelsignore=perforce....@lists.dwarfstd.org<mailto:dwarf-discuss-bounces~jdelsignore=perforce....@lists.dwarfstd.org>>
 On Behalf Of David Broman via Dwarf-discuss
Sent: Sunday, May 4, 2025 10:36 PM
To: dwarf-discuss@lists.dwarfstd.org<mailto:dwarf-discuss@lists.dwarfstd.org>
Subject: [Dwarf-discuss] DWARF on vintage CPUs

Hi, all, a question that may be out of scope for this list, but I'm hoping 
someone here might have answers anyway or be able to point me in the right 
direction.

I'm considering using DWARF for reading / writing debugging information for 
Motorola 6809 programs, but the first issue I come to is this from the DWARF 5 
spec, where it references the mapping between registers and numbers:

"Note that the register number represents a DWARF specific mapping of numbers 
onto the actual registers of a given architecture... It is recommended that 
this mapping be defined by the ABI authoring committee for each architecture"

In the case of the 6809 I have found no standard register mapping (likely 
similar situation with other vintage CPUs).


  1.  Maybe I just missed it... Does anyone know of an official register 
mapping for 6809?
  2.  If not, do you know who I would ask about this, or how a standard 
register mapping could get defined for 6809?
  3.  Can you think of other problems I might encounter later, trying to use 
DWARF for 6809 or other vintage CPU programs?

Background: The MAME project (https://www.mamedev.org/) emulates many old 
machines, CPUs, and other hardware.  It comes with a built-in disassembly 
debugger for the currently emulated CPU.   I'm working on adding a feature to 
the debugger to allow for source-level debugging (useful for developing new 
software for emulated CPUs).  This involves modifying build tools that target 
emulated machines to output debugging information, and MAME to consume that 
debugging information.  Largely for assemblers, but also for C-like or BASIC 
compilers.  Features would include:

  *   Source line mapping
  *   Symbol resolution (where C-like compilers might store variables at 
offsets to a register, thus requiring the register mapping)
  *   Maybe at some point in the future: stack unwinding (for compilers).


Thanks for your help!
David

CAUTION: This email originated from outside of the organization. Do not click 
on links or open attachments unless you recognize the sender and know the 
content is safe.



This e-mail may contain information that is privileged or confidential. If you 
are not the intended recipient, please delete the e-mail and any attachments 
and notify us immediately.

-- 
Dwarf-discuss mailing list
Dwarf-discuss@lists.dwarfstd.org
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss

Reply via email to