History

Bug in debugger when printing a vm_alloc Bug in vm_string - get_rune/set_rune Update all instantiations of vm_string to use {} - fixed issues

arr committed 9 years ago

Commit bd1f4931 parent 57e9d245 files · +32 −20Browse files

Showing the changes to src/exec/debugger.cpp (1 of 5 files). Show all

Unified · Split

src/exec/debugger.cpp+15−3
@@ -251,7 +251,7 @@ namespace · 250 unmodified lines
251251 return ss;
252252 }
253253
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)
255255 {
256256 if (alloc == nullptr)
257257 {
@@ -277,15 +277,27 @@ namespace · 19 unmodified lines
277277 {
278278 ss << "size: " << alloc->alloc_type->size_in_bytes << " alloc";
279279
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)
281281 {
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 << "...";
283290 });
284291 }
285292
286293 return ss;
287294 }
288295
296+ std::ostream& operator<<(std::ostream &ss, const vm_alloc_t *alloc)
297+ {
298+ return safe_alloc_print(ss, alloc, 0);
299+ }
300+
289301 std::ostream& operator<<(std::ostream &ss, const vm_thread_state_t s)
290302 {
291303 switch (s)