A shell that runs x86_64 assembly
c
x86-64
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

breakpoints.h 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Copyright Yann Weber <asmsh@yannweb.net>
  2. This file is part of asmsh.
  3. asmsh is free software: you can redistribute it and/or modify it under the
  4. terms of the GNU General Public License as published by the Free Software
  5. Foundation, either version 3 of the License, or any later version.
  6. asmsh is distributed in the hope that it will be useful, but WITHOUT ANY
  7. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  9. details.
  10. You should have received a copy of the GNU General Public License along
  11. with asmsh. If not, see <https://www.gnu.org/licenses/>.
  12. */
  13. #ifndef ASMSH_BREAKPOINTS_H
  14. #define ASMSH_BREAKPOINTS_H
  15. #include "config.h"
  16. #include <errno.h>
  17. #include <stdlib.h>
  18. #include "logger.h"
  19. typedef struct asmsh_brk_s asmsh_brk_t;
  20. /** Stores breakpoints informations */
  21. struct asmsh_brk_s
  22. {
  23. /** Breakpoint addresses sorted ascending */
  24. unsigned long *addrs;
  25. /** Number of breakpoints */
  26. size_t sz;
  27. };
  28. /** Initialize the breakpoint list
  29. * @param brks Pointer on the list to initialize
  30. * @return 0 if no error else -1
  31. */
  32. int asmsh_brk_init(asmsh_brk_t *brks);
  33. /** Cleanup a breakpoint list struct
  34. * @param brks Pointer on the list to clean
  35. */
  36. void asmsh_brk_free(asmsh_brk_t *brks);
  37. /** Add a breakpoint
  38. * @param brks Pointer on the list
  39. * @param addr The breakpoint's address
  40. * @return 0 if no error 1 if allready present else -1 and set errno
  41. */
  42. int asmsh_brk_add(asmsh_brk_t *brks, unsigned long addr);
  43. /** Del a breakpoint
  44. * @param brks Pointer on the list
  45. * @param addr The breakpoint's address
  46. * @return 0 if no error 1 if not present else -1 and set errno
  47. */
  48. int asmsh_brk_del(asmsh_brk_t *brks, unsigned long addr);
  49. /** Check if a breakpoint exists
  50. * @param brks Pointer on the list
  51. * @param addr The address to check
  52. * @return 0 if no breakpoint at given address
  53. */
  54. int asmsh_brk_isset(asmsh_brk_t *brks, unsigned long addr);
  55. #endif