MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / PrintCode

Function PrintCode

third-party/lua-5.5.0/src/luac.c:335–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333#define ISK (isk ? "k" : "")
334
335static void PrintCode(const Proto* f)
336{
337 const Instruction* code=f->code;
338 int pc,n=f->sizecode;
339 for (pc=0; pc<n; pc++)
340 {
341 Instruction i=code[pc];
342 OpCode o=GET_OPCODE(i);
343 int a=GETARG_A(i);
344 int b=GETARG_B(i);
345 int c=GETARG_C(i);
346 int ax=GETARG_Ax(i);
347 int bx=GETARG_Bx(i);
348 int sb=GETARG_sB(i);
349 int sc=GETARG_sC(i);
350 int vb=GETARG_vB(i);
351 int vc=GETARG_vC(i);
352 int sbx=GETARG_sBx(i);
353 int isk=GETARG_k(i);
354 int line=luaG_getfuncline(f,pc);
355 printf("\t%d\t",pc+1);
356 if (line>0) printf("[%d]\t",line); else printf("[-]\t");
357 printf("%-9s\t",opnames[o]);
358 switch (o)
359 {
360 case OP_MOVE:
361 printf("%d %d",a,b);
362 break;
363 case OP_LOADI:
364 printf("%d %d",a,sbx);
365 break;
366 case OP_LOADF:
367 printf("%d %d",a,sbx);
368 break;
369 case OP_LOADK:
370 printf("%d %d",a,bx);
371 printf(COMMENT); PrintConstant(f,bx);
372 break;
373 case OP_LOADKX:
374 printf("%d",a);
375 printf(COMMENT); PrintConstant(f,EXTRAARG);
376 break;
377 case OP_LOADFALSE:
378 printf("%d",a);
379 break;
380 case OP_LFALSESKIP:
381 printf("%d",a);
382 break;
383 case OP_LOADTRUE:
384 printf("%d",a);
385 break;
386 case OP_LOADNIL:
387 printf("%d %d",a,b);
388 printf(COMMENT "%d out",b+1);
389 break;
390 case OP_GETUPVAL:
391 printf("%d %d",a,b);
392 printf(COMMENT "%s",UPVALNAME(b));

Callers 1

PrintFunctionFunction · 0.70

Calls 2

luaG_getfunclineFunction · 0.70
PrintConstantFunction · 0.70

Tested by

no test coverage detected