History

Update stack walk in debugger to show source file name. Format function name to include full type signature.

arr committed 9 years ago

Commit 2b710fc1 parent 72f24ec3 files · +173 −13Browse files

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

Unified · Split

src/include/vm_asm.h+15−2
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <cstdint>
1414 #include "opcodes.h"
1515 #include "runtime.h"
16+#include "utils.h"
1617
1718 namespace disvm
1819 {
@@ -406,6 +407,17 @@ namespace disvm · 387 unmodified lines
406407 int32_t end_column;
407408 };
408409
410+ enum class function_name_format_t
411+ {
412+ name = 1,
413+ return_type = (1 << 1),
414+ arguments = (1 << 2),
415+
416+ declaration = name | arguments | return_type,
417+ };
418+
419+ DEFINE_ENUM_FLAG_OPERATORS(function_name_format_t);
420+
409421 class symbol_debug_t
410422 {
411423 public:
@@ -424,9 +436,10 @@ namespace disvm · 12 unmodified lines
424436 // Returns 'true' if the function was successful, otherwise 'false'.
425437 virtual bool try_advance_pc(advance_pc_t, disvm::runtime::vm_pc_t *pc_after_advance = nullptr) = 0;
426438
427− // Return the name of the function encompassing the current pc.
439+ // Return the name of the function containing the current pc.
440+ // Optionally format the returned string.
428441 // This function will throw a 'std::runtime_error' if a function doesn't exist at the current pc.
429− virtual const std::string & current_function_name() const = 0;
442+ virtual std::string current_function_name(function_name_format_t f = function_name_format_t::name) const = 0;
430443
431444 // Return the source location for the current pc
432445 virtual source_ref_t current_source_location() const = 0;