kgdb.c (95d002e0a34cb0f238abb39987f9980f325d8332) | kgdb.c (e836673c9b4966bc78e38aeda25f7022c57f0e90) |
---|---|
1/* 2 * This program is free software; you can redistribute it and/or modify it 3 * under the terms of the GNU General Public License as published by the 4 * Free Software Foundation; either version 2, or (at your option) any 5 * later version. 6 * 7 * This program is distributed in the hope that it will be useful, but 8 * WITHOUT ANY WARRANTY; without even the implied warranty of --- 745 unchanged lines hidden (view full) --- 754 BREAK_INSTR_SIZE); 755 if (err) 756 return err; 757 err = probe_kernel_write((char *)bpt->bpt_addr, 758 arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE); 759 if (!err) 760 return err; 761 /* | 1/* 2 * This program is free software; you can redistribute it and/or modify it 3 * under the terms of the GNU General Public License as published by the 4 * Free Software Foundation; either version 2, or (at your option) any 5 * later version. 6 * 7 * This program is distributed in the hope that it will be useful, but 8 * WITHOUT ANY WARRANTY; without even the implied warranty of --- 745 unchanged lines hidden (view full) --- 754 BREAK_INSTR_SIZE); 755 if (err) 756 return err; 757 err = probe_kernel_write((char *)bpt->bpt_addr, 758 arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE); 759 if (!err) 760 return err; 761 /* |
762 * It is safe to call text_poke() because normal kernel execution | 762 * It is safe to call text_poke_kgdb() because normal kernel execution |
763 * is stopped on all cores, so long as the text_mutex is not locked. 764 */ 765 if (mutex_is_locked(&text_mutex)) 766 return -EBUSY; | 763 * is stopped on all cores, so long as the text_mutex is not locked. 764 */ 765 if (mutex_is_locked(&text_mutex)) 766 return -EBUSY; |
767 text_poke((void *)bpt->bpt_addr, arch_kgdb_ops.gdb_bpt_instr, 768 BREAK_INSTR_SIZE); | 767 text_poke_kgdb((void *)bpt->bpt_addr, arch_kgdb_ops.gdb_bpt_instr, 768 BREAK_INSTR_SIZE); |
769 err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE); 770 if (err) 771 return err; 772 if (memcmp(opc, arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE)) 773 return -EINVAL; 774 bpt->type = BP_POKE_BREAKPOINT; 775 776 return err; 777} 778 779int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) 780{ 781 int err; 782 char opc[BREAK_INSTR_SIZE]; 783 784 if (bpt->type != BP_POKE_BREAKPOINT) 785 goto knl_write; 786 /* | 769 err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE); 770 if (err) 771 return err; 772 if (memcmp(opc, arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE)) 773 return -EINVAL; 774 bpt->type = BP_POKE_BREAKPOINT; 775 776 return err; 777} 778 779int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) 780{ 781 int err; 782 char opc[BREAK_INSTR_SIZE]; 783 784 if (bpt->type != BP_POKE_BREAKPOINT) 785 goto knl_write; 786 /* |
787 * It is safe to call text_poke() because normal kernel execution | 787 * It is safe to call text_poke_kgdb() because normal kernel execution |
788 * is stopped on all cores, so long as the text_mutex is not locked. 789 */ 790 if (mutex_is_locked(&text_mutex)) 791 goto knl_write; | 788 * is stopped on all cores, so long as the text_mutex is not locked. 789 */ 790 if (mutex_is_locked(&text_mutex)) 791 goto knl_write; |
792 text_poke((void *)bpt->bpt_addr, bpt->saved_instr, BREAK_INSTR_SIZE); | 792 text_poke_kgdb((void *)bpt->bpt_addr, bpt->saved_instr, 793 BREAK_INSTR_SIZE); |
793 err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE); 794 if (err || memcmp(opc, bpt->saved_instr, BREAK_INSTR_SIZE)) 795 goto knl_write; 796 return err; 797 798knl_write: 799 return probe_kernel_write((char *)bpt->bpt_addr, 800 (char *)bpt->saved_instr, BREAK_INSTR_SIZE); --- 12 unchanged lines hidden --- | 794 err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE); 795 if (err || memcmp(opc, bpt->saved_instr, BREAK_INSTR_SIZE)) 796 goto knl_write; 797 return err; 798 799knl_write: 800 return probe_kernel_write((char *)bpt->bpt_addr, 801 (char *)bpt->saved_instr, BREAK_INSTR_SIZE); --- 12 unchanged lines hidden --- |