Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: sim/msp430/trace.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sim/msp430/trace.h ('k') | sim/ppc/COPYING » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sim/msp430/trace.c
diff --git a/sim/rl78/trace.c b/sim/msp430/trace.c
similarity index 82%
copy from sim/rl78/trace.c
copy to sim/msp430/trace.c
index f0c98c4b646b37ecc7ddeccf26123cb5cb55d83f..a86ea881c10adba5f76785f7c8952d59e2a70ffb 100644
--- a/sim/rl78/trace.c
+++ b/sim/msp430/trace.c
@@ -1,6 +1,6 @@
-/* trace.c --- tracing output for the RL78 simulator.
+/* trace.c --- tracing output for the MSP430 simulator.
- Copyright (C) 2005, 2007-2012 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of the GNU simulators.
@@ -33,15 +33,10 @@
#include "bfd.h"
#include "dis-asm.h"
-#include "cpu.h"
-#include "mem.h"
-#include "load.h"
-
static int
sim_dis_read (bfd_vma memaddr, bfd_byte * ptr, unsigned int length,
struct disassemble_info *info)
{
- mem_get_blk (memaddr, ptr, length);
return 0;
}
@@ -52,7 +47,7 @@ sim_dis_read (bfd_vma memaddr, bfd_byte * ptr, unsigned int length,
static long
remove_useless_symbols (asymbol ** symbols, long count)
{
- register asymbol **in_ptr = symbols, **out_ptr = symbols;
+ asymbol **in_ptr = symbols, **out_ptr = symbols;
while (-- count >= 0)
{
@@ -67,6 +62,14 @@ remove_useless_symbols (asymbol ** symbols, long count)
if (bfd_is_und_section (sym->section)
|| bfd_is_com_section (sym->section))
continue;
+
+ if (sym->name[0] == '.' && sym->name[1] == 'L')
+ continue;
+
+ /* If the symbol ends in ^A or ^B it is
+ an assembler generated local label. */
+ if (sym->name[strlen (sym->name) - 1] < 32)
+ continue;
*out_ptr++ = sym;
}
@@ -108,7 +111,7 @@ static bfd_vma code_base = 0;
static struct disassemble_info info;
void
-sim_disasm_init (bfd *prog)
+msp430_trace_init (bfd *prog)
{
current_bfd = prog;
}
@@ -181,15 +184,18 @@ load_file_and_line (const char *filename, int lineno)
}
int
-sim_get_current_source_location (const char ** pfilename,
- const char ** pfunctionname,
- unsigned int * plineno)
+msp430_get_current_source_location (int mypc,
+ const char ** pfilename,
+ const char ** pfunctionname,
+ unsigned int * plineno)
{
static int initted = 0;
- int mypc = pc;
if (current_bfd == NULL)
- return 0;
+ {
+ printf("no bfd\n");
+ return 0;
+ }
if (!initted)
{
@@ -203,7 +209,7 @@ sim_get_current_source_location (const char ** pfilename,
info.arch = bfd_get_arch (current_bfd);
info.mach = bfd_get_mach (current_bfd);
if (info.mach == 0)
- info.arch = bfd_arch_rl78;
+ info.arch = bfd_arch_msp430;
disassemble_init_for_target (& info);
@@ -238,7 +244,7 @@ sim_get_current_source_location (const char ** pfilename,
}
void
-sim_disasm_one (void)
+msp430_trace_one (int mypc)
{
static int last_sym = -1;
static const char * prev_filename = "";
@@ -248,14 +254,10 @@ sim_disasm_one (void)
unsigned int lineno;
int sym, bestaddr;
int min, max, i;
- int save_trace = trace;
- int mypc = pc;
- if (! sim_get_current_source_location (& filename, & functionname, & lineno))
+ if (! msp430_get_current_source_location (mypc, & filename, & functionname, & lineno))
return;
- trace = 0;
-
if (filename && functionname && lineno)
{
if (lineno != prev_lineno || strcmp (prev_filename, filename))
@@ -267,10 +269,10 @@ sim_disasm_one (void)
slash = filename;
else
slash ++;
- printf
- ("========================================"
+ fprintf
+ (stderr, "========================================"
"=====================================\n");
- printf ("\033[37;41m %s:%d: \033[33;40m %s\033[K\033[0m\n",
+ fprintf (stderr, "\033[37;41m %s:%d: \033[33;40m %s\033[K\033[0m\n",
slash, lineno, the_line);
}
prev_lineno = lineno;
@@ -301,10 +303,10 @@ sim_disasm_one (void)
if (min != -1 && min != last_sym)
{
bestaddr = bfd_asymbol_value (symtab[min]);
- printf ("\033[43;30m%s", bfd_asymbol_name (symtab[min]));
+ fprintf (stderr, "\033[43;30m%s", bfd_asymbol_name (symtab[min]));
if (bestaddr != mypc)
- printf ("+%d", mypc - bestaddr);
- printf (":\t\t\t\033[0m\n");
+ fprintf (stderr, "+%d", mypc - bestaddr);
+ fprintf (stderr, ":\t\t\t\033[0m\n");
last_sym = min;
#if 0
if (trace == 1)
@@ -313,30 +315,4 @@ sim_disasm_one (void)
trace = 0;
#endif
}
-
-#define TCR0 0xf0180
-
- opbuf[0] = 0;
-#ifdef CYCLE_ACCURATE
- printf ("\033[33m %04u %06x: ", (int)(regs.cycle_count % 10000), mypc);
-#else
- printf ("\033[33m %08llx %06x: ", total_clocks, mypc);
-#endif
-
- max = print_insn_rl78 (mypc, & info);
-
- for (i = 0; i < max; i ++)
- printf ("%02x", mem_get_qi (mypc + i));
-
- do
- {
- printf (" ");
- i ++;
- }
- while (i < 6);
-
- printf ("%-16s ", opbuf);
-
- printf ("\033[0m\n");
- trace = save_trace;
}
« no previous file with comments | « sim/msp430/trace.h ('k') | sim/ppc/COPYING » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698