From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7882) id 4C2983857C59; Tue, 13 Sep 2022 06:23:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C2983857C59 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663050204; bh=I8oj11AlZPNl2AQCsKK9djqGorulHIGlffNeAj3P+ME=; h=From:To:Subject:Date:From; b=ZbWa1xLFoOAeYuwTxlm3R2WrwjRmeqLCUPzj5ibbTqF/WePW1xFfCRmby6OzYDAo5 m1rbqveDTJEtozfOPQr6GmyAyaxIr8jbYrRT1Yb38GIoF2Z/NBaPNduP5fTEQ/5J8f eWFpKdUnBtZjjz+7DJykd/vbIGwLt7NJkKV43F0Q= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jiangshuai Li To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/csky rm csky_memory_insert/remove_breakpoint X-Act-Checkin: binutils-gdb X-Git-Author: Jiangshuai Li X-Git-Refname: refs/heads/master X-Git-Oldrev: d354e0c8e7d333d2ec1796f8ce4216e892a4c714 X-Git-Newrev: c0828c5a52c3107743f64c57ca6cdfa9ed156114 Message-Id: <20220913062324.4C2983857C59@sourceware.org> Date: Tue, 13 Sep 2022 06:23:24 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc0828c5a52c3= 107743f64c57ca6cdfa9ed156114 commit c0828c5a52c3107743f64c57ca6cdfa9ed156114 Author: Jiangshuai Li Date: Tue Sep 13 14:21:55 2022 +0800 gdb/csky rm csky_memory_insert/remove_breakpoint =20 Software breakpoints are inserted or removed by the gdb stub via remote protocol, these two functions are no longer needed. Diff: --- gdb/csky-tdep.c | 201 ----------------------------------------------------= ---- 1 file changed, 201 deletions(-) diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index 3cd7a775f8d..aeb2fab4309 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -2016,201 +2016,6 @@ csky_sw_breakpoint_from_kind (struct gdbarch *gdbar= ch, int kind, int *size) } } =20 -/* Implement the memory_insert_breakpoint gdbarch method. */ - -static int -csky_memory_insert_breakpoint (struct gdbarch *gdbarch, - struct bp_target_info *bp_tgt) -{ - int val; - const unsigned char *bp; - gdb_byte bp_write_record1[] =3D { 0, 0, 0, 0 }; - gdb_byte bp_write_record2[] =3D { 0, 0, 0, 0 }; - gdb_byte bp_record[] =3D { 0, 0, 0, 0 }; - - /* Sanity-check bp_address. */ - if (bp_tgt->reqstd_address % 2) - warning (_("Invalid breakpoint address 0x%x is an odd number."), - (unsigned int) bp_tgt->reqstd_address); - scoped_restore restore_memory - =3D make_scoped_restore_show_memory_breakpoints (1); - - /* Determine appropriate breakpoint_kind for this address. */ - bp_tgt->kind =3D csky_breakpoint_kind_from_pc (gdbarch, - &bp_tgt->reqstd_address); - - /* Save the memory contents. */ - bp_tgt->shadow_len =3D bp_tgt->kind; - - /* Fill bp_tgt->placed_address. */ - bp_tgt->placed_address =3D bp_tgt->reqstd_address; - - if (bp_tgt->kind =3D=3D CSKY_INSN_SIZE16) - { - if ((bp_tgt->reqstd_address % 4) =3D=3D 0) - { - /* Read two bytes. */ - val =3D target_read_memory (bp_tgt->reqstd_address, - bp_tgt->shadow_contents, 2); - if (val) - return val; - - /* Read two bytes. */ - val =3D target_read_memory (bp_tgt->reqstd_address + 2, - bp_record, 2); - if (val) - return val; - - /* Write the breakpoint. */ - bp_write_record1[2] =3D bp_record[0]; - bp_write_record1[3] =3D bp_record[1]; - bp =3D bp_write_record1; - val =3D target_write_raw_memory (bp_tgt->reqstd_address, bp, - CSKY_WR_BKPT_MODE); - } - else - { - val =3D target_read_memory (bp_tgt->reqstd_address, - bp_tgt->shadow_contents, 2); - if (val) - return val; - - val =3D target_read_memory (bp_tgt->reqstd_address - 2, - bp_record, 2); - if (val) - return val; - - /* Write the breakpoint. */ - bp_write_record1[0] =3D bp_record[0]; - bp_write_record1[1] =3D bp_record[1]; - bp =3D bp_write_record1; - val =3D target_write_raw_memory (bp_tgt->reqstd_address - 2, - bp, CSKY_WR_BKPT_MODE); - } - } - else - { - if (bp_tgt->placed_address % 4 =3D=3D 0) - { - val =3D target_read_memory (bp_tgt->reqstd_address, - bp_tgt->shadow_contents, - CSKY_WR_BKPT_MODE); - if (val) - return val; - - /* Write the breakpoint. */ - bp =3D bp_write_record1; - val =3D target_write_raw_memory (bp_tgt->reqstd_address, - bp, CSKY_WR_BKPT_MODE); - } - else - { - val =3D target_read_memory (bp_tgt->reqstd_address, - bp_tgt->shadow_contents, - CSKY_WR_BKPT_MODE); - if (val) - return val; - - val =3D target_read_memory (bp_tgt->reqstd_address - 2, - bp_record, 2); - if (val) - return val; - - val =3D target_read_memory (bp_tgt->reqstd_address + 4, - bp_record + 2, 2); - if (val) - return val; - - bp_write_record1[0] =3D bp_record[0]; - bp_write_record1[1] =3D bp_record[1]; - bp_write_record2[2] =3D bp_record[2]; - bp_write_record2[3] =3D bp_record[3]; - - /* Write the breakpoint. */ - bp =3D bp_write_record1; - val =3D target_write_raw_memory (bp_tgt->reqstd_address - 2, bp, - CSKY_WR_BKPT_MODE); - if (val) - return val; - - /* Write the breakpoint. */ - bp =3D bp_write_record2; - val =3D target_write_raw_memory (bp_tgt->reqstd_address + 2, bp, - CSKY_WR_BKPT_MODE); - } - } - return val; -} - -/* Restore the breakpoint shadow_contents to the target. */ - -static int -csky_memory_remove_breakpoint (struct gdbarch *gdbarch, - struct bp_target_info *bp_tgt) -{ - int val; - gdb_byte bp_record[] =3D { 0, 0, 0, 0, 0, 0, 0, 0 }; - /* Different for shadow_len 2 or 4. */ - if (bp_tgt->shadow_len =3D=3D 2) - { - /* Do word-sized writes on word-aligned boundaries and read - padding bytes as necessary. */ - if (bp_tgt->reqstd_address % 4 =3D=3D 0) - { - val =3D target_read_memory (bp_tgt->reqstd_address + 2, - bp_record + 2, 2); - if (val) - return val; - bp_record[0] =3D bp_tgt->shadow_contents[0]; - bp_record[1] =3D bp_tgt->shadow_contents[1]; - return target_write_raw_memory (bp_tgt->reqstd_address, - bp_record, CSKY_WR_BKPT_MODE); - } - else - { - val =3D target_read_memory (bp_tgt->reqstd_address - 2, - bp_record, 2); - if (val) - return val; - bp_record[2] =3D bp_tgt->shadow_contents[0]; - bp_record[3] =3D bp_tgt->shadow_contents[1]; - return target_write_raw_memory (bp_tgt->reqstd_address - 2, - bp_record, CSKY_WR_BKPT_MODE); - } - } - else - { - /* Do word-sized writes on word-aligned boundaries and read - padding bytes as necessary. */ - if (bp_tgt->placed_address % 4 =3D=3D 0) - { - return target_write_raw_memory (bp_tgt->reqstd_address, - bp_tgt->shadow_contents, - CSKY_WR_BKPT_MODE); - } - else - { - val =3D target_read_memory (bp_tgt->reqstd_address - 2, - bp_record, 2); - if (val) - return val; - val =3D target_read_memory (bp_tgt->reqstd_address + 4, - bp_record+6, 2); - if (val) - return val; - - bp_record[2] =3D bp_tgt->shadow_contents[0]; - bp_record[3] =3D bp_tgt->shadow_contents[1]; - bp_record[4] =3D bp_tgt->shadow_contents[2]; - bp_record[5] =3D bp_tgt->shadow_contents[3]; - - return target_write_raw_memory (bp_tgt->reqstd_address - 2, - bp_record, - CSKY_WR_BKPT_MODE * 2); - } - } -} - /* Determine link register type. */ =20 static lr_type_t @@ -3062,12 +2867,6 @@ csky_gdbarch_init (struct gdbarch_info info, struct = gdbarch_list *arches) frame_unwind_append_unwinder (gdbarch, &csky_stub_unwind); frame_unwind_append_unwinder (gdbarch, &csky_unwind_cache); =20 - /* Breakpoints. */ - set_gdbarch_memory_insert_breakpoint (gdbarch, - csky_memory_insert_breakpoint); - set_gdbarch_memory_remove_breakpoint (gdbarch, - csky_memory_remove_breakpoint); - /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch);