m68k gdb stub - Page 1
Forum section: electronics / general

author: legacy
author_rank: Super Contributor
timestamp: February 28, 2015, 01:14:22 pm
content: hi guysdoes anyone has a pretty well written gdb stub for m68k ?i have seen something in the gdb sources, but it is not well writtenwandering if to fix it, or if to rewrite it, or if someone has already rewritten itin case let me know.minimal features required to interface the gdb serial protocol

author: codeboy2k
author_rank: Super Contributor
timestamp: March 01, 2015, 01:09:51 am
content: Wow, I haven't worked on the 68k since... I don't know.. 1986, 89 maybewhat are you doing with it?

author: westfw
author_rank: Super Contributor
timestamp: March 01, 2015, 01:16:45 am
content: The HP *standard* 68k gdb stub is the one you don't like? That's ancient; I would have thought it was tuned to perfection!(OTOH, that was also probably the first gdb stub ever written.)

author: legacy
author_rank: Super Contributor
timestamp: March 01, 2015, 10:53:09 am
content: Quote from: codeboy2k on March 01, 2015, 01:09:51 ama 68K board, with a Yamaha V9958 VDU (it's RGB-S video output) and a CS8900 lanit's an hobby project, i need the gdb-stub to do code-inject, and common debug

author: legacy
author_rank: Super Contributor
timestamp: March 01, 2015, 10:58:09 am
content: Quote from: westfw on March 01, 2015, 01:16:45 amdon't know, i have downloaded gdb sources and found a stub for m68k in the "stub" folderbut it is very ugly piece of code: C89, assembly inline mixed, and too much GNU dependentmy sierra C compiler has reported ~100 errors and ~400 warningsi have removed the assembly inline from the C source, and then tried with gcc: 2 errors, ~200 warningsbtw, i think i will rewrite it from scratches

author: westfw
author_rank: Super Contributor
timestamp: March 02, 2015, 07:04:41 am
content: Wow. It is in pretty bad shape, isn't it.You might want to look at some of the newer 68k variants. CPU32 and Coldfire, for instance.For example, this version:https://code.google.com/p/coldfire-gdb-stub/source/browse/trunk/src/gdb_src/coldfire-stub.cat least gets rid of the page-long multi-line strings in "asm" commands.I don't think you'll be able to get away without some assembler and compiler dependencies. You're dealing with low-level traps and data arrangements, which are almost certainly not fully accessible to "true" C.

author: legacy
author_rank: Super Contributor
timestamp: March 02, 2015, 09:38:49 am
content: excellent idea, thank you

author: hsimpson1357
author_rank: Newbie
timestamp: May 06, 2025, 01:33:08 am
content: Hello, did you ever get a working GDB stub for the 68000? I'm looking for one right now and even the coldfire stub linked above is pretty ugly. As a matter of fact it doesn't even work for the 68000 (even though I got it to compile).

author: Harjit
author_rank: Regular Contributor
timestamp: May 08, 2025, 08:25:12 pm
content: Some places to look (that I saved off for gcc and gdb):https://github.com/haarer/toolchain68khttps://support.dce.felk.cvut.cz/nms/cpuarch/m68k/mo_cpu2-quick-start.htmlhttps://crosstool-ng.github.io/http://download.ronetix.at/toolchains/crosstool-ng/https://gnutoolchains.com/m68k-elf/

author: Harjit
author_rank: Regular Contributor
timestamp: May 12, 2025, 07:11:16 pm
content: Another link:https://github.com/hth313/Calypsi-tool-chains

author: yar
author_rank: Contributor
timestamp: May 14, 2025, 10:25:07 pm
content: The GDB source tree used to have one in it. I couldn't have blamed them if they'd removed it in the last 30+ years, but it was there in the 90s.Oh, come on. It'sstillthere.https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/stubs/m68k-stub.cLast time I looked at those stubs in detail, they were about 70% dealing with parsing strings and serial port handling and about 30% a normal exception handler that just happened to grope and fondle registers on the way in or out or before or after.

author: westfw
author_rank: Super Contributor
timestamp: May 15, 2025, 12:47:58 am
content: QuoteThe original complaint was that the existing version was "not well written."I mean, much looks pre-C89, and function definitions are a mix of old and new style:Code:535 unsigned char *536 getpacket (void)537 {Code:607 void608 putpacket (buffer)609 char *buffer;610 {