@@ -18,12 +18,14 @@ class OMDebugger
1818 void debugStack ()
1919 {
2020 logger.debug (" format examples: " );
21- logger.debug (fmt::format (" {}" , fmt::styled (" normal data" , fmt::fg (fmt::color::white))));
21+ logger.debug (fmt::format (" {}" , fmt::styled (" operator stack" , fmt::fg (fmt::color::alice_blue))));
22+ logger.debug (fmt::format (" {}" , fmt::styled (" local variable table" , fmt::fg (fmt::color::light_blue))));
2223 logger.debug (fmt::format (" {}" , fmt::styled (" frame metadata" , fmt::fg (fmt::color::yellow_green))));
2324 logger.debug (fmt::format (" {}" , fmt::styled (" free / dirty data" , fmt::fg (fmt::color::gray))));
2425
2526 void *currentData = (uint8_t *)v0::currentThread.stackPointer - 6 * sizeof (void *);
26- auto style = fmt::fg (fmt::color::white);
27+ auto style = fmt::fg (fmt::color::dark_green);
28+ auto frame = v0::currentThread.currentFrame ;
2729 while (true )
2830 {
2931 std::string desc = " " ;
@@ -38,21 +40,27 @@ class OMDebugger
3840 }
3941 else
4042 {
41- style = fmt::fg (fmt::color::antique_white );
43+ style = fmt::fg (fmt::color::alice_blue );
4244
43- auto frame = v0::currentThread.currentFrame ;
44- while (frame != nullptr )
45+ if (frame == currentData)
4546 {
46- if (frame == currentData)
47- {
48- desc = fmt::format (" <== Frame base of {}.{}{}" , frame->method ->klass ->name , frame->method ->name ,
49- frame->method ->desc );
50- }
51- if ((size_t )currentData - (size_t )frame < sizeof (v0::OMFrame))
47+ desc = fmt::format (" <== Frame base of {}.{}{}" , frame->method ->klass ->name , frame->method ->name ,
48+ frame->method ->desc );
49+ }
50+
51+ if ((size_t )currentData - (size_t )frame < sizeof (v0::OMFrame))
52+ {
53+ style = fmt::fg (fmt::color::yellow_green);
54+ if ((size_t )currentData - (size_t )frame + sizeof (void *) >= sizeof (v0::OMFrame))
5255 {
53- style = fmt::fg (fmt::color::yellow_green) ;
56+ frame = frame-> prev ;
5457 }
55- frame = frame->prev ;
58+ }
59+ else if ((size_t )frame - (size_t )currentData <= frame->method ->maxLocals * sizeof (void *))
60+ {
61+ style = fmt::fg (fmt::color::light_blue);
62+ desc = fmt::format (" <== Local variable #{}" ,
63+ ((size_t )frame - (size_t )currentData) / sizeof (void *) - 1 );
5664 }
5765 }
5866
0 commit comments