2000-07-22 19:03:03 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
/* dbg.h */
|
2000-07-22 19:03:03 +00:00
|
|
|
/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Debugger module interface */
|
2000-07-22 19:03:03 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
2015-03-10 09:53:52 +00:00
|
|
|
/* (C) 1998-2000, Ullrich von Bassewitz */
|
|
|
|
/* Roemerstrasse 52 */
|
|
|
|
/* D-70794 Filderstadt */
|
|
|
|
/* EMail: uz@cc65.org */
|
2000-07-22 19:03:03 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
/* arising from the use of this software. */
|
|
|
|
/* */
|
|
|
|
/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
/* freely, subject to the following restrictions: */
|
|
|
|
/* */
|
|
|
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
/* claim that you wrote the original software. If you use this software */
|
|
|
|
/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
/* appreciated but is not required. */
|
|
|
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
/* be misrepresented as being the original software. */
|
|
|
|
/* 3. This notice may not be removed or altered from any source */
|
|
|
|
/* distribution. */
|
|
|
|
/* */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
/*
|
2014-06-30 09:10:35 +00:00
|
|
|
** This is the interface to the cc65 debugger. Since many of the functions
|
|
|
|
** used for the debugger are quite usable even in another context, they
|
|
|
|
** are declared here.
|
|
|
|
**
|
|
|
|
** To use the debugger, just call DbgInit in your application. Once it has
|
2022-04-17 14:05:19 +00:00
|
|
|
** been called, the debugger will catch any BRK opcode. Use the BREAK macro
|
2014-06-30 09:10:35 +00:00
|
|
|
** defined below to insert breakpoints into your code.
|
|
|
|
**
|
|
|
|
** There are currently a lot of things that cannot be debugged, graphical
|
|
|
|
** applications are an example. The debugger does not save your screen
|
|
|
|
** contents, so even your text screen gets destroyed. However, you can
|
|
|
|
** debug the C and runtime library, even if the debugger is using this
|
|
|
|
** stuff itself.
|
|
|
|
**
|
|
|
|
** Note: When using the debugger, there are some other identifiers with
|
|
|
|
** external linkage, that start with Dbg. Avoid those names if you use the
|
|
|
|
** module.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _DBG_H
|
|
|
|
#define _DBG_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Utility functions */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned __fastcall__ DbgDisAsm (unsigned Addr, char* Buf, unsigned char Len);
|
|
|
|
/* Disassemble one instruction at address addr into the given buffer.
|
2014-06-30 09:10:35 +00:00
|
|
|
** The resulting line has the format, "AAAA__BB_BB_BB___OPC_OPERAND",
|
|
|
|
** where AAAA is the hexadecimal representation of addr, BB are the
|
|
|
|
** bytes (in hex) that make the instruction, OPC is the mnemonic, and
|
|
|
|
** OPERAND is an operand for the instruction.
|
|
|
|
** The buffer is filled with spaces up to the given length and terminated as
|
|
|
|
** a usual C string. NOTE: Buf must be able to hold Len+1 characters.
|
|
|
|
** The function returns the length of the disassembled instruction, so,
|
|
|
|
** to disassemble the next instruction, add the return value to addr
|
|
|
|
** and call the function again.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
unsigned __fastcall__ DbgDisAsmLen (unsigned Addr);
|
|
|
|
/* Disassemble one instruction, but do only return the length, do not
|
2014-06-30 09:10:35 +00:00
|
|
|
** create a visible representation. This function is useful when
|
|
|
|
** disassembling backwards, it is much faster than DbgDisAsm.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
int __fastcall__ DbgIsRAM (unsigned Addr);
|
|
|
|
/* Return true if we can read and write the given address */
|
|
|
|
|
2015-03-10 09:53:52 +00:00
|
|
|
char* __cdecl__ DbgMemDump (unsigned Addr, char* Buf, unsigned char Len);
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Create a line of a memory dump in the given buffer. The buffer contains
|
2014-06-30 09:10:35 +00:00
|
|
|
** the starting address (4 digits hex), then Len bytes in this format:
|
|
|
|
** "AAAA__XX_YY_ZZ_...". The passed char buffer must hold Len*3+5 bytes
|
|
|
|
** plus a terminator byte.
|
|
|
|
** The function does not work correctly if the created string is longer
|
|
|
|
** than 255 bytes.
|
|
|
|
** The return value is Buf.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* High level user interface */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void __fastcall__ DbgInit (unsigned unused);
|
|
|
|
/* Initialize the debugger. Use 0 as parameter. The debugger will popup on
|
2014-06-30 09:10:35 +00:00
|
|
|
** next brk encountered.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
#define BREAK() __asm__ ("brk")
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Use this to insert breakpoints into your code */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* End of dbg.h */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-17 14:05:19 +00:00
|
|
|
|