File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -503,6 +503,12 @@ uint64_t
503
503
avr_get_time_stamp (
504
504
avr_t * avr );
505
505
506
+ /* This function returns a text string describing where in flash the AVR's
507
+ * PC is pointing. It requires the CONFIG_SIMAVR_TRACE option.
508
+ */
509
+
510
+ const char * avr_where (avr_t * avr );
511
+
506
512
#ifdef __cplusplus
507
513
};
508
514
#endif
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ int dont_trace(const char * name)
71
71
72
72
static int donttrace ;
73
73
74
- static const char * where (avr_t * avr )
74
+ const char * avr_where (avr_t * avr )
75
75
{
76
76
avr_flashaddr_t pc ;
77
77
const char * s ;
@@ -100,8 +100,8 @@ static const char *where(avr_t *avr)
100
100
return "" ;
101
101
}
102
102
103
- #define STATE (_f , argsf ...) if (avr->trace) { \
104
- const char *symn = where (avr); \
103
+ #define STATE (_f , argsf ...) if (avr->trace) { \
104
+ const char *symn = avr_where (avr); \
105
105
if (symn) \
106
106
printf("%04x: %-25s " _f, avr->pc, symn, ## argsf); \
107
107
}
@@ -161,6 +161,8 @@ void crash(avr_t* avr)
161
161
avr_sadly_crashed (avr , 0 );
162
162
163
163
}
164
+
165
+ const char * avr_where (avr_t * avr ) { return "" ; }
164
166
#endif
165
167
166
168
static inline uint16_t
Original file line number Diff line number Diff line change @@ -306,6 +306,7 @@ int avr_read_dwarf(avr_t *avr, const char *filename)
306
306
CHECK ("dwarf_siblingof_b" );
307
307
308
308
#if CONFIG_SIMAVR_TRACE
309
+ Dwarf_Addr prev_addr = -1 ;
309
310
const char * last_symbol = NULL ;
310
311
int i , prev_line ;
311
312
@@ -322,9 +323,10 @@ int avr_read_dwarf(avr_t *avr, const char *filename)
322
323
CHECK ("dwarf_lineno" );
323
324
rv = dwarf_lineaddr (ctx .lines [i ], & addr , & err );
324
325
CHECK ("dwarf_lineaddr" );
325
- if (prev_line == lineno )
326
+ if (prev_line == lineno || prev_addr == addr )
326
327
continue ; // Ignore duplicates
327
328
prev_line = lineno ;
329
+ prev_addr = addr ;
328
330
if (addr == 0 ) // Inlined?
329
331
continue ;
330
332
ep = avr -> trace_data -> codeline + (addr >> 1 );
You can’t perform that action at this time.
0 commit comments