| OLD | NEW |
| 1 /* Native-dependent code for the i386. | 1 /* Native-dependent code for the i386. |
| 2 | 2 |
| 3 Low level functions to implement Oeprating System specific | 3 Low level functions to implement Oeprating System specific |
| 4 code to manipulate I386 debug registers. | 4 code to manipulate I386 debug registers. |
| 5 | 5 |
| 6 Copyright (C) 2009-2012 Free Software Foundation, Inc. | 6 Copyright (C) 2009-2012 Free Software Foundation, Inc. |
| 7 | 7 |
| 8 This file is part of GDB. | 8 This file is part of GDB. |
| 9 | 9 |
| 10 This program is free software; you can redistribute it and/or modify | 10 This program is free software; you can redistribute it and/or modify |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 that will be called to insert watchpoints and hardware breakpoints | 46 that will be called to insert watchpoints and hardware breakpoints |
| 47 into the inferior, remove them, and check their status. These | 47 into the inferior, remove them, and check their status. These |
| 48 functions are: | 48 functions are: |
| 49 | 49 |
| 50 set_control -- set the debug control (DR7) | 50 set_control -- set the debug control (DR7) |
| 51 register to a given value for all LWPs | 51 register to a given value for all LWPs |
| 52 | 52 |
| 53 set_addr -- put an address into one debug | 53 set_addr -- put an address into one debug |
| 54 register for all LWPs | 54 register for all LWPs |
| 55 | 55 |
| 56 reset_addr -- reset the address stored in | 56 get_addr -- return the address in a given debug |
| 57 » » » » one debug register for all LWPs | 57 » » » » register of the current LWP |
| 58 | 58 |
| 59 get_status -- return the value of the debug | 59 get_status -- return the value of the debug |
| 60 status (DR6) register for current LWP | 60 status (DR6) register for current LWP |
| 61 | 61 |
| 62 unset_status -- unset the specified bits of the debug | 62 get_control -- return the value of the debug |
| 63 » » » » status (DR6) register for all LWPs | 63 » » » » control (DR7) register for current LWP |
| 64 | 64 |
| 65 Additionally, the native file should set the debug_register_length | 65 Additionally, the native file should set the debug_register_length |
| 66 field to 4 or 8 depending on the number of bytes used for | 66 field to 4 or 8 depending on the number of bytes used for |
| 67 deubg registers. */ | 67 deubg registers. */ |
| 68 | 68 |
| 69 struct i386_dr_low_type | 69 struct i386_dr_low_type |
| 70 { | 70 { |
| 71 void (*set_control) (unsigned long); | 71 void (*set_control) (unsigned long); |
| 72 void (*set_addr) (int, CORE_ADDR); | 72 void (*set_addr) (int, CORE_ADDR); |
| 73 void (*reset_addr) (int); | 73 CORE_ADDR (*get_addr) (int); |
| 74 unsigned long (*get_status) (void); | 74 unsigned long (*get_status) (void); |
| 75 void (*unset_status) (unsigned long); | 75 unsigned long (*get_control) (void); |
| 76 int debug_register_length; | 76 int debug_register_length; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 extern struct i386_dr_low_type i386_dr_low; | 79 extern struct i386_dr_low_type i386_dr_low; |
| 80 | 80 |
| 81 /* Debug registers' indices. */ |
| 82 #define DR_FIRSTADDR 0 |
| 83 #define DR_LASTADDR 3 |
| 84 #define DR_NADDR 4 /* The number of debug address registers. */ |
| 85 #define DR_STATUS 6 /* Index of debug status register (DR6). */ |
| 86 #define DR_CONTROL 7 /* Index of debug control register (DR7). */ |
| 87 |
| 88 /* Global state needed to track h/w watchpoints. */ |
| 89 |
| 90 struct i386_debug_reg_state |
| 91 { |
| 92 /* Mirror the inferior's DRi registers. We keep the status and |
| 93 control registers separated because they don't hold addresses. |
| 94 Note that since we can change these mirrors while threads are |
| 95 running, we never trust them to explain a cause of a trap. |
| 96 For that, we need to peek directly in the inferior registers. */ |
| 97 CORE_ADDR dr_mirror[DR_NADDR]; |
| 98 unsigned dr_status_mirror, dr_control_mirror; |
| 99 |
| 100 /* Reference counts for each debug register. */ |
| 101 int dr_ref_count[DR_NADDR]; |
| 102 }; |
| 103 |
| 81 /* Use this function to set i386_dr_low debug_register_length field | 104 /* Use this function to set i386_dr_low debug_register_length field |
| 82 rather than setting it directly to check that the length is only | 105 rather than setting it directly to check that the length is only |
| 83 set once. It also enables the 'maint set/show show-debug-regs' | 106 set once. It also enables the 'maint set/show show-debug-regs' |
| 84 command. */ | 107 command. */ |
| 85 | 108 |
| 86 extern void i386_set_debug_register_length (int len); | 109 extern void i386_set_debug_register_length (int len); |
| 87 | 110 |
| 88 /* Use this function to reset the i386-nat.c debug register state. */ | 111 /* Use this function to reset the i386-nat.c debug register state. */ |
| 89 | 112 |
| 90 extern void i386_cleanup_dregs (void); | 113 extern void i386_cleanup_dregs (void); |
| 91 | 114 |
| 115 /* Return a pointer to the the local mirror of the inferior's debug |
| 116 registers. */ |
| 117 |
| 118 extern struct i386_debug_reg_state *i386_debug_reg_state (void); |
| 119 |
| 92 #endif /* I386_NAT_H */ | 120 #endif /* I386_NAT_H */ |
| OLD | NEW |