Showing the changes to src/exec/debugger.cpp (1 of 5 files). Show all
Unified · Split
| @@ -251,7 +251,7 @@ namespace · 250 unmodified lines | |||
| 251 | return ss; | 251 | return ss; |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | std::ostream& operator<<(std::ostream &ss, const vm_alloc_t *alloc) | 254 | std::ostream& safe_alloc_print(std::ostream &ss, const vm_alloc_t *alloc, int recurse_depth) |
| 255 | { | 255 | { |
| 256 | if (alloc == nullptr) | 256 | if (alloc == nullptr) |
| 257 | { | 257 | { |
| @@ -277,15 +277,27 @@ namespace · 19 unmodified lines | |||
| 277 | { | 277 | { |
| 278 | ss << "size: " << alloc->alloc_type->size_in_bytes << " alloc"; | 278 | ss << "size: " << alloc->alloc_type->size_in_bytes << " alloc"; |
| 279 | 279 | ||
| 280 | enum_pointer_fields(*alloc->alloc_type, alloc->get_allocation(), [&ss](pointer_t p, std::size_t o) | 280 | enum_pointer_fields(*alloc->alloc_type, alloc->get_allocation(), [&ss, recurse_depth](pointer_t p, std::size_t o) |
| 281 | { | 281 | { |
| 282 | ss << "\n [" << o << "] " << vm_alloc_t::from_allocation(p); | 282 | ss << "\n"; |
| 283 | std::fill_n(std::ostream_iterator<std::ostream::char_type>{ ss }, 4 * recurse_depth, ' '); | ||
| 284 | ss << "[" << o << "] "; | ||
| 285 | |||
| 286 | if (recurse_depth < 2) | ||
| 287 | safe_alloc_print(ss, vm_alloc_t::from_allocation(p), recurse_depth + 1); | ||
| 288 | else | ||
| 289 | ss << "..."; | ||
| 283 | }); | 290 | }); |
| 284 | } | 291 | } |
| 285 | 292 | ||
| 286 | return ss; | 293 | return ss; |
| 287 | } | 294 | } |
| 288 | 295 | ||
| 296 | std::ostream& operator<<(std::ostream &ss, const vm_alloc_t *alloc) | ||
| 297 | { | ||
| 298 | return safe_alloc_print(ss, alloc, 0); | ||
| 299 | } | ||
| 300 | |||
| 289 | std::ostream& operator<<(std::ostream &ss, const vm_thread_state_t s) | 301 | std::ostream& operator<<(std::ostream &ss, const vm_thread_state_t s) |
| 290 | { | 302 | { |
| 291 | switch (s) | 303 | switch (s) |