Showing the changes to src/include (1 of 3 files). Show all
Unified · Split
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <cstdint> | 13 | #include <cstdint> |
| 14 | #include "opcodes.h" | 14 | #include "opcodes.h" |
| 15 | #include "runtime.h" | 15 | #include "runtime.h" |
| 16 | #include "utils.h" | ||
| 16 | 17 | ||
| 17 | namespace disvm | 18 | namespace disvm |
| 18 | { | 19 | { |
| @@ -406,6 +407,17 @@ namespace disvm · 387 unmodified lines | |||
| 406 | int32_t end_column; | 407 | int32_t end_column; |
| 407 | }; | 408 | }; |
| 408 | 409 | ||
| 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 | |||
| 409 | class symbol_debug_t | 421 | class symbol_debug_t |
| 410 | { | 422 | { |
| 411 | public: | 423 | public: |
| @@ -424,9 +436,10 @@ namespace disvm · 12 unmodified lines | |||
| 424 | // Returns 'true' if the function was successful, otherwise 'false'. | 436 | // Returns 'true' if the function was successful, otherwise 'false'. |
| 425 | virtual bool try_advance_pc(advance_pc_t, disvm::runtime::vm_pc_t *pc_after_advance = nullptr) = 0; | 437 | virtual bool try_advance_pc(advance_pc_t, disvm::runtime::vm_pc_t *pc_after_advance = nullptr) = 0; |
| 426 | 438 | ||
| 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. | ||
| 428 | // This function will throw a 'std::runtime_error' if a function doesn't exist at the current pc. | 441 | // 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; |
| 430 | 443 | ||
| 431 | // Return the source location for the current pc | 444 | // Return the source location for the current pc |
| 432 | virtual source_ref_t current_source_location() const = 0; | 445 | virtual source_ref_t current_source_location() const = 0; |