public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [Patch, microblaze]: Communicate in larger blocks with the target.
@ 2014-06-17  9:03 Ajit Kumar Agarwal
  2014-06-17 13:49 ` Pedro Alves
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Ajit Kumar Agarwal @ 2014-06-17  9:03 UTC (permalink / raw)
  To: gdb-patches
  Cc: Michael Eager, Vinod Kathail, Vidhumouli Hunsigida, Nagaraju Mekala

[-- 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-07-24  2:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17  9:03 [Patch, microblaze]: Communicate in larger blocks with the target Ajit Kumar Agarwal
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).