|
15 | 15 | #include <stdio.h> |
16 | 16 |
|
17 | 17 | LUAU_FASTFLAG(LuauCurrentLineBounds) |
| 18 | +LUAU_FASTFLAGVARIABLE(LuauHeapNameDetails) |
18 | 19 |
|
19 | 20 | static void validateobjref(global_State* g, GCObject* f, GCObject* t) |
20 | 21 | { |
@@ -728,10 +729,20 @@ static void enumclosure(EnumContext* ctx, Closure* cl) |
728 | 729 |
|
729 | 730 | char buf[LUA_IDSIZE]; |
730 | 731 |
|
731 | | - if (p->source) |
732 | | - snprintf(buf, sizeof(buf), "%s:%d %s", p->debugname ? getstr(p->debugname) : "", p->linedefined, getstr(p->source)); |
| 732 | + if (FFlag::LuauHeapNameDetails) |
| 733 | + { |
| 734 | + if (p->source) |
| 735 | + snprintf(buf, sizeof(buf), "%s:%d %s", p->debugname ? getstr(p->debugname) : "unnamed", p->linedefined, getstr(p->source)); |
| 736 | + else |
| 737 | + snprintf(buf, sizeof(buf), "%s:%d", p->debugname ? getstr(p->debugname) : "unnamed", p->linedefined); |
| 738 | + } |
733 | 739 | else |
734 | | - snprintf(buf, sizeof(buf), "%s:%d", p->debugname ? getstr(p->debugname) : "", p->linedefined); |
| 740 | + { |
| 741 | + if (p->source) |
| 742 | + snprintf(buf, sizeof(buf), "%s:%d %s", p->debugname ? getstr(p->debugname) : "", p->linedefined, getstr(p->source)); |
| 743 | + else |
| 744 | + snprintf(buf, sizeof(buf), "%s:%d", p->debugname ? getstr(p->debugname) : "", p->linedefined); |
| 745 | + } |
735 | 746 |
|
736 | 747 | enumnode(ctx, obj2gco(cl), sizeLclosure(cl->nupvalues), buf); |
737 | 748 | } |
@@ -799,10 +810,21 @@ static void enumthread(EnumContext* ctx, lua_State* th) |
799 | 810 |
|
800 | 811 | char buf[LUA_IDSIZE]; |
801 | 812 |
|
802 | | - if (p->source) |
803 | | - snprintf(buf, sizeof(buf), "%s:%d %s", p->debugname ? getstr(p->debugname) : "", p->linedefined, getstr(p->source)); |
| 813 | + if (FFlag::LuauHeapNameDetails) |
| 814 | + { |
| 815 | + if (p->source) |
| 816 | + snprintf(buf, sizeof(buf), "thread at %s:%d %s", p->debugname ? getstr(p->debugname) : "unnamed", p->linedefined, getstr(p->source)); |
| 817 | + else |
| 818 | + snprintf(buf, sizeof(buf), "thread at %s:%d", p->debugname ? getstr(p->debugname) : "unnamed", p->linedefined); |
| 819 | + } |
804 | 820 | else |
805 | | - snprintf(buf, sizeof(buf), "%s:%d", p->debugname ? getstr(p->debugname) : "", p->linedefined); |
| 821 | + { |
| 822 | + |
| 823 | + if (p->source) |
| 824 | + snprintf(buf, sizeof(buf), "%s:%d %s", p->debugname ? getstr(p->debugname) : "", p->linedefined, getstr(p->source)); |
| 825 | + else |
| 826 | + snprintf(buf, sizeof(buf), "%s:%d", p->debugname ? getstr(p->debugname) : "", p->linedefined); |
| 827 | + } |
806 | 828 |
|
807 | 829 | enumnode(ctx, obj2gco(th), size, buf); |
808 | 830 | } |
@@ -835,7 +857,21 @@ static void enumproto(EnumContext* ctx, Proto* p) |
835 | 857 | ctx->edge(ctx->context, enumtopointer(obj2gco(p)), p->execdata, "[native]"); |
836 | 858 | } |
837 | 859 |
|
838 | | - enumnode(ctx, obj2gco(p), size, p->source ? getstr(p->source) : NULL); |
| 860 | + if (FFlag::LuauHeapNameDetails) |
| 861 | + { |
| 862 | + char buf[LUA_IDSIZE]; |
| 863 | + |
| 864 | + if (p->source) |
| 865 | + snprintf(buf, sizeof(buf), "proto %s:%d %s", p->debugname ? getstr(p->debugname) : "unnamed", p->linedefined, getstr(p->source)); |
| 866 | + else |
| 867 | + snprintf(buf, sizeof(buf), "proto %s:%d", p->debugname ? getstr(p->debugname) : "unnamed", p->linedefined); |
| 868 | + |
| 869 | + enumnode(ctx, obj2gco(p), size, buf); |
| 870 | + } |
| 871 | + else |
| 872 | + { |
| 873 | + enumnode(ctx, obj2gco(p), size, p->source ? getstr(p->source) : NULL); |
| 874 | + } |
839 | 875 |
|
840 | 876 | if (p->sizek) |
841 | 877 | enumedges(ctx, obj2gco(p), p->k, p->sizek, "constants"); |
|
0 commit comments