History

Add support for inleaving source information into disassembly view in debugger.

arr committed 9 years ago

Commit eb8b0901 parent 2b710fc4 files · +217 −59Browse files

Showing the changes to src/include (1 of 4 files). Show all

Unified · Split

src/include/vm_asm.h+25−12
@@ -407,6 +407,7 @@ namespace disvm · 406 unmodified lines
407407 int32_t end_column;
408408 };
409409
410+ // Enumeration for formatting a function name
410411 enum class function_name_format_t
411412 {
412413 name = 1,
@@ -418,20 +419,20 @@ namespace disvm · 5 unmodified lines
418419
419420 DEFINE_ENUM_FLAG_OPERATORS(function_name_format_t);
420421
421− class symbol_debug_t
422+ // Enumeration for advancing the pc
423+ enum class advance_pc_t
424+ {
425+ current, // Return the current pc
426+ next_pc,
427+ next_debug_statement, // Advance to the next debug statement (i.e. source language statement)
428+ };
429+
430+ class symbol_pc_iter_t
422431 {
423432 public:
424433 // Set the current pc
425434 virtual void set_current_pc(disvm::runtime::vm_pc_t) = 0;
426435
427− // Enumeration for advancing the pc
428− enum class advance_pc_t
429− {
430− current, // Return the current pc
431− next_pc,
432− next_debug_statement, // Advance to the next debug statement (i.e. source language statement)
433− };
434−
435436 // Advance the current pc.
436437 // Returns 'true' if the function was successful, otherwise 'false'.
437438 virtual bool try_advance_pc(advance_pc_t, disvm::runtime::vm_pc_t *pc_after_advance = nullptr) = 0;
@@ -439,7 +440,7 @@ namespace disvm · 1 unmodified line
439440 // Return the name of the function containing the current pc.
440441 // Optionally format the returned string.
441442 // This function will throw a 'std::runtime_error' if a function doesn't exist at the current pc.
442− virtual std::string current_function_name(function_name_format_t f = function_name_format_t::name) const = 0;
443+ virtual std::string current_function_name(function_name_format_t f) const = 0;
443444
444445 // Return the source location for the current pc
445446 virtual source_ref_t current_source_location() const = 0;
@@ -448,6 +449,13 @@ namespace disvm · 2 unmodified lines
448449 virtual const std::string &get_source_by_id(int32_t source_id) const = 0;
449450 };
450451
452+ struct function_data_t
453+ {
454+ disvm::runtime::vm_pc_t entry_pc;
455+ disvm::runtime::vm_pc_t limit_pc;
456+ std::string name;
457+ };
458+
451459 class symbol_data_t
452460 {
453461 public:
@@ -457,10 +465,15 @@ namespace disvm · 3 unmodified lines
457465 // Get instruction count in the symbol data
458466 virtual size_t get_instruction_count() const = 0;
459467
460− // Get interface over symbol data targeted for debugging
461− virtual std::unique_ptr<symbol_debug_t> get_debug() = 0;
468+ // Get list of functions in module.
469+ // Supply a formatting enum for the function name.
470+ virtual std::vector<function_data_t> get_functions(function_name_format_t f) const = 0;
471+
472+ // Get pc iterator interface over symbol data
473+ virtual std::unique_ptr<symbol_pc_iter_t> get_pc_iter() const = 0;
462474 };
463475
476+ // Read in symbol data from the supplied stream
464477 std::unique_ptr<symbol_data_t> read(std::istream &);
465478 }
466479