@@ -3381,15 +3381,24 @@ const size_t hexEncodingSize = 11;
33813381
33823382#ifdef DEBUG
33833383// ------------------------------------------------------------------------
3384+ // emitDispInsIndent: Print indentation corresponding to an instruction's
3385+ // indentation.
3386+ //
3387+ void emitter::emitDispInsIndent ()
3388+ {
3389+ size_t indent = emitComp->opts .disDiffable ? basicIndent : basicIndent + hexEncodingSize;
3390+ printf (" %.*s" , indent, " " );
3391+ }
3392+ // ------------------------------------------------------------------------
33843393// emitDispGCDeltaTitle: Print an appropriately indented title for a GC info delta
33853394//
33863395// Arguments:
33873396// title - The type of GC info delta we're printing
33883397//
33893398void emitter::emitDispGCDeltaTitle (const char * title)
33903399{
3391- size_t indent = emitComp-> opts . disDiffable ? basicIndent : basicIndent + hexEncodingSize ;
3392- printf (" %.*s ; %s" , indent, " " , title);
3400+ emitDispInsIndent () ;
3401+ printf (" ; %s" , title);
33933402}
33943403
33953404// ------------------------------------------------------------------------
@@ -6233,7 +6242,8 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
62336242#define DEFAULT_CODE_BUFFER_INIT 0xcc
62346243
62356244#ifdef DEBUG
6236- *instrCount = 0 ;
6245+ *instrCount = 0 ;
6246+ PreciseIPMapping* nextMapping = emitComp->genPreciseIPMappingsHead ;
62376247#endif
62386248 for (insGroup* ig = emitIGlist; ig != nullptr ; ig = ig->igNext )
62396249 {
@@ -6402,6 +6412,33 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
64026412#ifdef DEBUG
64036413 size_t curInstrAddr = (size_t )cp;
64046414 instrDesc* curInstrDesc = id;
6415+
6416+ if ((emitComp->opts .disAsm || emitComp->verbose ) && (JitConfig.JitDisasmWithDebugInfo () != 0 ))
6417+ {
6418+ UNATIVE_OFFSET curCodeOffs = emitCurCodeOffs (cp);
6419+ while (nextMapping != nullptr )
6420+ {
6421+ UNATIVE_OFFSET mappingOffs = nextMapping->nativeLoc .CodeOffset (this );
6422+
6423+ if (mappingOffs > curCodeOffs)
6424+ {
6425+ // Still haven't reached instruction that next mapping belongs to.
6426+ break ;
6427+ }
6428+
6429+ // We reached the mapping or went past it.
6430+ if (mappingOffs == curCodeOffs)
6431+ {
6432+ emitDispInsIndent ();
6433+ printf (" ; " );
6434+ nextMapping->debugInfo .Dump (true );
6435+ printf (" \n " );
6436+ }
6437+
6438+ nextMapping = nextMapping->next ;
6439+ }
6440+ }
6441+
64056442#endif
64066443
64076444 castto (id, BYTE*) += emitIssue1Instr (ig, id, &cp);
0 commit comments