Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

If God had intended Man to program, we'd be born with serial I/O ports.


devel / comp.sys.apple2.programmer / Re: Generic question about Apple2 / cc65 debugging

SubjectAuthor
* Generic question about Apple2 / cc65 debuggingColin Leroy-Mira
`* Re: Generic question about Apple2 / cc65 debuggingOliver Schmidt
 `* Re: Generic question about Apple2 / cc65 debuggingColin Leroy-Mira
  `- Re: Generic question about Apple2 / cc65 debuggingOliver Schmidt

1
Generic question about Apple2 / cc65 debugging

<20230811201326.30841582@laptop-sigfox>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=335&group=comp.sys.apple2.programmer#335

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED.93.8.31.152!not-for-mail
From: col...@colino.net (Colin Leroy-Mira)
Newsgroups: comp.sys.apple2.programmer
Subject: Generic question about Apple2 / cc65 debugging
Date: Fri, 11 Aug 2023 20:13:26 +0200
Organization: A noiseless patient Spider
Message-ID: <20230811201326.30841582@laptop-sigfox>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="93.8.31.152";
logging-data="394498"; mail-complaints-to="abuse@eternal-september.org"
X-Newsreader: Claws Mail 3.19.1git30 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
 by: Colin Leroy-Mira - Fri, 11 Aug 2023 18:13 UTC

Hi,

You may have noticed I'm back in my retrocomputing rabbit hole, so a
question pops back in my mind that I didn't find a good solution to
last winter: how does one debug cc65-generated code while sucking at
assembly?

I have found workarounds: I use a special conio.h with definitions that
allow me to also build my programs for Linux x86_64, and then I can
more or less run and test my code with modern tools like gdb and
valgrind.
But that's far from perfect, given how the standard types differ in
size, and also, I do have some low-level code #ifdef'd __CC65__, which
I can't test in the same ways.

I test my programs runtime using Mame, and I know of its debugger. But
this is very very far from the comfort of gdb or valgrind, which have
mappings to the source files and can break and show variables anywhere
in the program.

I'm asking because I'm sometimes baffled by problems on which I can't
find anything to progress. (Like earlier, when I used a wrapper to
chdir() instead of chdir() in a function, and my program clearly had
huge, visible memory corruption issues before even reaching that code.

In these cases I can't help thinking "compiler bug!" but my experience
tells me that the problem probably comes from me, and the different
binary simply uncovers something hidden.

Would you folks have some pointers for me? (If it is of any use, I
develop on Linux)

Thanks!
--
Colin
https://www.colino.net/

Re: Generic question about Apple2 / cc65 debugging

<ub5vud$6uso$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=336&group=comp.sys.apple2.programmer#336

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ol....@web.de (Oliver Schmidt)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Generic question about Apple2 / cc65 debugging
Date: Fri, 11 Aug 2023 18:50:53 -0000 (UTC)
Message-ID: <ub5vud$6uso$1@solani.org>
References: <20230811201326.30841582@laptop-sigfox>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Aug 2023 18:50:53 -0000 (UTC)
Injection-Info: solani.org;
logging-data="228248"; mail-complaints-to="abuse@news.solani.org"
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:WFUK+GOgQuSzgcVVn9ElVbuOu8U= sha1:q7D1qJ2DJ6RLKCfMSzyaEUpQRbc=
X-User-ID: eJwNxskBwCAIBMCWJMC6loMc/Zdg5jWuEOQ2OMzHRzh2/xxW64lsbnp/1WyjJk1W4c5wAhVrPScvEa0=
 by: Oliver Schmidt - Fri, 11 Aug 2023 18:50 UTC

Hi Colin,

> how does one debug cc65-generated code while sucking at
> assembly?

Certainly not the silver bullet you might be looking for, but what's there:

Build with options that generate additional files which allow you to relate
addresses you see in the monitor of an emulator to your source code.

1. Create a map file. It tells you where your functions are placed in
memory: --mapfile <file>

2. Create a listing file with source comments. It tells you which source
code line belongs to which offset: --listing <file> --add-source

So even when you don't understand assembly you can this way follow which
source code line is currently executed or set breakpoints on a source code
line.

Regards,
Oliver

Re: Generic question about Apple2 / cc65 debugging

<20230812151206.37af6bb6@laptop-sigfox>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=337&group=comp.sys.apple2.programmer#337

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: col...@colino.net (Colin Leroy-Mira)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Generic question about Apple2 / cc65 debugging
Date: Sat, 12 Aug 2023 15:12:06 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <20230812151206.37af6bb6@laptop-sigfox>
References: <20230811201326.30841582@laptop-sigfox>
<ub5vud$6uso$1@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="946110cf81da7be4d1367d31f480d066";
logging-data="1413382"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1QI70r1SVwMycbWRnsCEnAKx03rt3OdM="
Cancel-Lock: sha1:jFjsiZg2MrgMc0U+F+a9Qfzu1/0=
X-Newsreader: Claws Mail 3.19.1git30 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
 by: Colin Leroy-Mira - Sat, 12 Aug 2023 13:12 UTC

Hi,

>2. Create a listing file with source comments. It tells you which
>source code line belongs to which offset: --listing <file> --add-source

I've tried using --listing --add-source before, but I can't understand
what I'm doing wrong. Maybe it's not supposed to be used directly with
the cl65 helper:

cl65 -t ... -o program --listing <file> [numerous .c files]

generates a listing for only the last c file of the list.
--
Colin
https://www.colino.net/

Re: Generic question about Apple2 / cc65 debugging

<ub8qlt$so1$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=338&group=comp.sys.apple2.programmer#338

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: ol....@web.de (Oliver Schmidt)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Generic question about Apple2 / cc65 debugging
Date: Sat, 12 Aug 2023 20:39:25 -0000 (UTC)
Message-ID: <ub8qlt$so1$1@solani.org>
References: <20230811201326.30841582@laptop-sigfox>
<ub5vud$6uso$1@solani.org>
<20230812151206.37af6bb6@laptop-sigfox>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 12 Aug 2023 20:39:25 -0000 (UTC)
Injection-Info: solani.org;
logging-data="29441"; mail-complaints-to="abuse@news.solani.org"
User-Agent: NewsTap/5.5 (iPhone/iPod Touch)
Cancel-Lock: sha1:EedyoXeADrvxbyjwlSD2OLUgN1o= sha1:LPX2ACD7bjyKnyLRYgfhHAKSCmg=
X-User-ID: eJwFwQcBADAIAzBLlFNADnv+JSwJI7jTGfR48TqXBFRyZKQEfHar9Fivaw3b3nAMK1V7jn/65w/a
 by: Oliver Schmidt - Sat, 12 Aug 2023 20:39 UTC

Hi Colin,

> I've tried using --listing --add-source before, but I can't understand
> what I'm doing wrong. Maybe it's not supposed to be used directly with
> the cl65 helper:
>
> cl65 -t ... -o program --listing <file> [numerous .c files]
>
> generates a listing for only the last c file of the list.

There's one listing file for each source file. So the approach above can
conceptually not work.

I don't know if this works:
cl65 -t ... -o program --listing a.lst a.c --listing b.lst b.c

Anyhow, I'd rather create each object file individually with this:
cl65 -c -t ... --listing x.lst --add-source x.c

Regards,
Oliver

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor