From: Ajit Kumar Agarwal <ajit.kumar.agarwal@xilinx.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Michael Eager <eager@eagercon.com>,
Vinod Kathail <vinodk@xilinx.com>,
Vidhumouli Hunsigida <vidhum@xilinx.com>,
Nagaraju Mekala <nmekala@xilinx.com>
Subject: [Patch, microblaze]: Communicate in larger blocks with the target.
Date: Tue, 17 Jun 2014 09:03:00 -0000 [thread overview]
Message-ID: <41df2189-0a72-4543-ba31-297f81e663d7@BN1AFFO11FD025.protection.gbl> (raw)
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
Please find the following patch.
[Patch, microblaze]: Communicate in larger blocks with the target.
Communicate in larger blocks with the target. The chunk of memory
will be read from the target and then used in microblaze_analyze_prologue.
The above process minimizes the transaction with the Debug Agent.
ChangeLog:
2014-06-17 Ajit Agarwal <ajitkum@xilinx.com>
* microblaze-tdep.c (microblaze_analyze_prologue): Use of
target_read_memory. Populate insn_block. Use of insn_block.
Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
Thanks & Regards
Ajit
[-- Attachment #2: 0001-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch --]
[-- Type: application/octet-stream, Size: 2782 bytes --]
From ba8a22d10755ab7835f67b1ea553e089ad8767da Mon Sep 17 00:00:00 2001
From: Ajit Kumar Agarwal <ajitkum@xhdspdgnu.(none)>
Date: Tue, 17 Jun 2014 14:27:02 +0530
Subject: [PATCH] [Patch, microblaze]: Communicate in larger blocks with the target.
Communicate in larger blocks with the target. The chunk of memory
will be read from the target and then used in microblaze_analyze_prologue.
The above process minimizes the transaction with the Debug Agent.
ChangeLog:
2014-06-17 Ajit Agarwal <ajitkum@xilinx.com>
* microblaze-tdep.c (microblaze_analyze_prologue): Use of
target_read_memory. Populate insn_block. Use of insn_block.
Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
---
gdb/microblaze-tdep.c | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 14c1b52..b1efbe2 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -234,6 +234,10 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
int flags = 0;
int save_hidden_pointer_found = 0;
int non_stack_instruction_found = 0;
+ int n_insns;
+ unsigned long *insn_block;
+ gdb_byte *buf_block;
+ int ti, tj;
/* Find the start of this function. */
find_pc_partial_function (pc, &name, &func_addr, &func_end);
@@ -272,10 +276,23 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
microblaze_debug ("Scanning prologue: name=%s, func_addr=%s, stop=%s\n",
name, paddress (gdbarch, func_addr),
paddress (gdbarch, stop));
-
+
+ /*Do a block read to minimize the transaction with the Debug Agent */
+ n_insns = (stop == func_addr) ? 1 : ((stop - func_addr) / INST_WORD_SIZE);
+ insn_block = (unsigned long *)calloc(n_insns, sizeof(unsigned long));
+ buf_block = (gdb_byte *)calloc(n_insns * INST_WORD_SIZE, sizeof(gdb_byte));
+
+ target_read_memory (func_addr, buf_block, n_insns * INST_WORD_SIZE );
+
+ for (ti = 0; ti < n_insns; ti++) {
+ insn_block[ti] = 0;
+ for (tj = ti * INST_WORD_SIZE; tj < (ti + 1) * INST_WORD_SIZE; tj++)
+ insn_block[ti] = (insn_block[ti] << 8) | buf_block[tj];
+ }
+
for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE)
{
- insn = microblaze_fetch_instruction (addr);
+ insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
microblaze_debug ("%s %08lx\n", paddress (gdbarch, pc), insn);
@@ -401,6 +418,9 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
part of the prologue. */
if (save_hidden_pointer_found)
prologue_end_addr -= INST_WORD_SIZE;
+
+ free(insn_block);
+ free(buf_block);
return prologue_end_addr;
}
--
1.7.1
next reply other threads:[~2014-06-17 9:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-17 9:03 Ajit Kumar Agarwal [this message]
2014-06-17 13:49 ` Pedro Alves
2014-06-17 16:34 ` Pedro Alves
2014-06-17 16:49 ` Ajit Kumar Agarwal
2014-06-17 16:52 ` Pedro Alves
2014-06-17 18:09 ` Ajit Kumar Agarwal
2014-06-17 18:13 ` Ajit Kumar Agarwal
2014-06-18 9:28 ` Pedro Alves
2014-07-24 2:39 ` Michael Eager
2014-06-17 14:47 ` Michael Eager
2014-06-17 16:32 ` Tom Tromey
2014-07-23 18:56 ` Michael Eager
2014-07-23 20:04 ` Michael Eager
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41df2189-0a72-4543-ba31-297f81e663d7@BN1AFFO11FD025.protection.gbl \
--to=ajit.kumar.agarwal@xilinx.com \
--cc=eager@eagercon.com \
--cc=gdb-patches@sourceware.org \
--cc=nmekala@xilinx.com \
--cc=vidhum@xilinx.com \
--cc=vinodk@xilinx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox