fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
at master 97 lines 3.1 kB view raw
1/***************************************************************************** 2 * pce * 3 *****************************************************************************/ 4 5/***************************************************************************** 6 * File name: src/lib/brkpt.h * 7 * Created: 2004-05-25 by Hampa Hug <hampa@hampa.ch> * 8 * Copyright: (C) 2004-2013 Hampa Hug <hampa@hampa.ch> * 9 *****************************************************************************/ 10 11/***************************************************************************** 12 * This program is free software. You can redistribute it and / or modify it * 13 * under the terms of the GNU General Public License version 2 as published * 14 * by the Free Software Foundation. * 15 * * 16 * This program is distributed in the hope that it will be useful, but * 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 * Public License for more details. * 20 *****************************************************************************/ 21 22 23#ifndef PCE_LIB_BRKPT_H 24#define PCE_LIB_BRKPT_H 1 25 26 27#include <stdio.h> 28 29#include <lib/cmd.h> 30 31 32#define BP_TYPE_ADDR 1 33#define BP_TYPE_SEGOFS 2 34#define BP_TYPE_EXPR 3 35 36 37/* a breakpoint */ 38typedef struct breakpoint_t { 39 unsigned type; 40 41 void (*del) (struct breakpoint_t *bp); 42 int (*match) (struct breakpoint_t *bp, unsigned seg, unsigned long addr); 43 void (*print) (struct breakpoint_t *bp, FILE *fp); 44 45 unsigned pass; 46 unsigned reset; 47 48 unsigned seg; 49 unsigned long addr; 50 51 char *expr; 52} breakpoint_t; 53 54 55/* a set of breakpoints */ 56typedef struct { 57 unsigned cnt; 58 breakpoint_t **bp; 59} bp_set_t; 60 61 62breakpoint_t *bp_new (unsigned type); 63 64void bp_set_pass (breakpoint_t *bp, unsigned pass, unsigned reset); 65 66unsigned bp_get_pass (breakpoint_t *bp); 67 68void bp_del (breakpoint_t *bp); 69int bp_match (breakpoint_t *bp, unsigned seg, unsigned long addr); 70void bp_print (breakpoint_t *bp, FILE *fp); 71 72breakpoint_t *bp_addr_new (unsigned long addr); 73breakpoint_t *bp_segofs_new (unsigned short seg, unsigned short ofs); 74breakpoint_t *bp_expr_new (const char *expr); 75 76 77void bps_init (bp_set_t *bps); 78void bps_free (bp_set_t *bps); 79 80int bps_bp_add (bp_set_t *bps, breakpoint_t *bp); 81 82breakpoint_t *bps_bp_get_index (bp_set_t *bps, unsigned idx); 83 84void bps_bp_del_index (bp_set_t *bps, unsigned idx); 85void bps_bp_del (bp_set_t *bps, breakpoint_t *bp); 86void bps_bp_del_all (bp_set_t *bps); 87 88void bps_list (bp_set_t *bps, FILE *fp); 89breakpoint_t *bps_match (bp_set_t *bps, unsigned seg, unsigned long addr); 90 91int bps_check (bp_set_t *bps, unsigned seg, unsigned long addr, FILE *fp); 92 93 94void cmd_do_b (cmd_t *cmd, bp_set_t *bps); 95 96 97#endif