@@ -517,7 +517,7 @@ def _validate_file_mtime(self):
517
517
518
518
# Called before loop, handles display expressions
519
519
# Set up convenience variable containers
520
- def preloop (self ):
520
+ def _show_display (self ):
521
521
displaying = self .displaying .get (self .curframe )
522
522
if displaying :
523
523
for expr , oldvalue in displaying .items ():
@@ -605,15 +605,13 @@ def interaction(self, frame, tb_or_exc):
605
605
self .setup (frame , tb )
606
606
# We should print the stack entry if and only if the user input
607
607
# is expected, and we should print it right before the user input.
608
- # If self.cmdqueue is not empty, we append a "w 0" command to the
609
- # queue, which is equivalent to print_stack_entry
610
- if self .cmdqueue :
611
- self .cmdqueue .append ('w 0' )
612
- else :
613
- self .print_stack_entry (self .stack [self .curindex ])
608
+ # We achieve this by appending _pdbcmd_print_frame_status to the
609
+ # command queue. If cmdqueue is not exausted, the user input is
610
+ # not expected and we will not print the stack entry.
611
+ self .cmdqueue .append ('_pdbcmd_print_frame_status' )
614
612
self ._cmdloop ()
615
- # If "w 0" is not used, pop it out
616
- if self .cmdqueue and self .cmdqueue [- 1 ] == 'w 0 ' :
613
+ # If _pdbcmd_print_frame_status is not used, pop it out
614
+ if self .cmdqueue and self .cmdqueue [- 1 ] == '_pdbcmd_print_frame_status ' :
617
615
self .cmdqueue .pop ()
618
616
self .forget ()
619
617
@@ -846,6 +844,10 @@ def onecmd(self, line):
846
844
"""
847
845
if not self .commands_defining :
848
846
self ._validate_file_mtime ()
847
+ if line .startswith ('_pdbcmd' ):
848
+ command , arg , line = self .parseline (line )
849
+ if hasattr (self , command ):
850
+ return getattr (self , command )(arg )
849
851
return cmd .Cmd .onecmd (self , line )
850
852
else :
851
853
return self .handle_command_def (line )
@@ -982,6 +984,12 @@ def completedefault(self, text, line, begidx, endidx):
982
984
state += 1
983
985
return matches
984
986
987
+ # Pdb meta commands, only intended to be used internally by pdb
988
+
989
+ def _pdbcmd_print_frame_status (self , arg ):
990
+ self .print_stack_trace (0 )
991
+ self ._show_display ()
992
+
985
993
# Command definitions, called by cmdloop()
986
994
# The argument is the remaining string on the command line
987
995
# Return true to exit from the command loop
0 commit comments