/* Copyright Yann Weber This file is part of asmsh. asmsh is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. asmsh is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with asmsh. If not, see . */ #ifndef ASMSH_BREAKPOINTS_H #define ASMSH_BREAKPOINTS_H #include "config.h" #include #include #include "logger.h" typedef struct asmsh_brk_s asmsh_brk_t; /** Stores breakpoints informations */ struct asmsh_brk_s { /** Breakpoint addresses sorted ascending */ unsigned long *addrs; /** Number of breakpoints */ size_t sz; }; /** Initialize the breakpoint list * @param brks Pointer on the list to initialize * @return 0 if no error else -1 */ int asmsh_brk_init(asmsh_brk_t *brks); /** Cleanup a breakpoint list struct * @param brks Pointer on the list to clean */ void asmsh_brk_free(asmsh_brk_t *brks); /** Add a breakpoint * @param brks Pointer on the list * @param addr The breakpoint's address * @return 0 if no error 1 if allready present else -1 and set errno */ int asmsh_brk_add(asmsh_brk_t *brks, unsigned long addr); /** Del a breakpoint * @param brks Pointer on the list * @param addr The breakpoint's address * @return 0 if no error 1 if not present else -1 and set errno */ int asmsh_brk_del(asmsh_brk_t *brks, unsigned long addr); /** Check if a breakpoint exists * @param brks Pointer on the list * @param addr The address to check * @return 0 if no breakpoint at given address */ int asmsh_brk_isset(asmsh_brk_t *brks, unsigned long addr); #endif