Simulator hooks?

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does the AS AVR Simulator (or any other AVR simulator, for that matter) provide any mechanism where a user-written host program can examine the chip state when a breakpoint is hit?  Basically, I'd like to have high-level code that is run, with access to the memories and registers of the simulated chip.

Picture a utility that puts of a GUI representation of dynamically allocated memory that updates each time through some loop, where of course malloc()/free() run as AVR code, but the code that analyzes the memory is completely non-intrusive and runs on the PC.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think there's an exposed API. The closest was back in AS4. The guy who wrote Hapsim reverse engineered the simulation DLLs and managed to install his own hooks but the whole thing would have to be reverse engineered again for AS7.
.
PS for GCC the linker has a way to "hook" calls like malloc so you could annotate them but that would have to be in runtime code.

Last Edited: Sun. Jan 27, 2019 - 02:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think your best bet would be simulavr, but it has several limitations, and I expect you'd have a fair amount of effort in front of you writing a code layer on top of it (or between it and GDB, or between GDB and DDD).  Should be documented well enough to make the attempt.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The code in https://github.com/avrsimulator/gdbproxy contains what is needed to load up any simulator model in studio into a gdb server. From there any hooks gdb et al provides would be accessible...

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The code in https://github.com/avrsimulator/gdbproxy contains what is needed to load up any simulator model in studio into a gdb server. From there any hooks gdb et al provides would be accessible...

That might be useful.  I was thinking that gdb scripting might be enough for the sorts of things I was thinking about.

Thanks!