@@ -350,10 +350,6 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None,
350
350
pass
351
351
352
352
self .commands = {} # associates a command list to breakpoint numbers
353
- self .commands_doprompt = {} # for each bp num, tells if the prompt
354
- # must be disp. after execing the cmd list
355
- self .commands_silent = {} # for each bp num, tells if the stack trace
356
- # must be disp. after execing the cmd list
357
353
self .commands_defining = False # True while in the process of defining
358
354
# a command list
359
355
self .commands_bnum = None # The breakpoint number for which we are
@@ -437,8 +433,8 @@ def user_line(self, frame):
437
433
or frame .f_lineno <= 0 ):
438
434
return
439
435
self ._wait_for_mainpyfile = False
440
- if self .bp_commands (frame ):
441
- self .interaction (frame , None )
436
+ self .bp_commands (frame )
437
+ self .interaction (frame , None )
442
438
443
439
user_opcode = user_line
444
440
@@ -453,18 +449,9 @@ def bp_commands(self, frame):
453
449
self .currentbp in self .commands :
454
450
currentbp = self .currentbp
455
451
self .currentbp = 0
456
- lastcmd_back = self .lastcmd
457
- self .setup (frame , None )
458
452
for line in self .commands [currentbp ]:
459
- self .onecmd (line )
460
- self .lastcmd = lastcmd_back
461
- if not self .commands_silent [currentbp ]:
462
- self .print_stack_entry (self .stack [self .curindex ])
463
- if self .commands_doprompt [currentbp ]:
464
- self ._cmdloop ()
465
- self .forget ()
466
- return
467
- return 1
453
+ self .cmdqueue .append (line )
454
+ self .cmdqueue .append (f'_pdbcmd_restore_lastcmd { self .lastcmd } ' )
468
455
469
456
def user_return (self , frame , return_value ):
470
457
"""This function is called when a return trap is set here."""
@@ -863,15 +850,15 @@ def handle_command_def(self, line):
863
850
cmd , arg , line = self .parseline (line )
864
851
if not cmd :
865
852
return False
866
- if cmd == 'silent' :
867
- self .commands_silent [self .commands_bnum ] = True
868
- return False # continue to handle other cmd def in the cmd list
869
- elif cmd == 'end' :
853
+ if cmd == 'end' :
870
854
return True # end of cmd list
871
855
elif cmd == 'EOF' :
872
856
print ('' )
873
857
return True # end of cmd list
874
858
cmdlist = self .commands [self .commands_bnum ]
859
+ if cmd == 'silent' :
860
+ cmdlist .append ('_pdbcmd_silence_frame_status' )
861
+ return False # continue to handle other cmd def in the cmd list
875
862
if arg :
876
863
cmdlist .append (cmd + ' ' + arg )
877
864
else :
@@ -883,7 +870,6 @@ def handle_command_def(self, line):
883
870
func = self .default
884
871
# one of the resuming commands
885
872
if func .__name__ <
9E88
span class=pl-c1>in self .commands_resuming :
886
- self .commands_doprompt [self .commands_bnum ] = False
887
873
return True
888
874
return False
889
875
@@ -996,6 +982,13 @@ def _pdbcmd_print_frame_status(self, arg):
996
982
self .print_stack_trace (0 )
997
983
self ._show_display ()
998
984
985
+ def _pdbcmd_silence_frame_status (self , arg ):
986
+ if self .cmdqueue and self .cmdqueue [- 1 ] == '_pdbcmd_print_frame_status' :
987
+ self .cmdqueue .pop ()
988
+
989
+ def _pdbcmd_restore_lastcmd (self , arg ):
990
+ self .lastcmd = arg
991
+
999
992
# Command definitions, called by cmdloop()
1000
993
# The argument is the remaining string on the command line
1001
994
# Return true to exit from the command loop
@@ -1054,14 +1047,10 @@ def do_commands(self, arg):
1054
1047
self .commands_bnum = bnum
1055
1048
# Save old definitions for the case of a keyboard interrupt.
1056
1049
if bnum in self .commands :
1057
- old_command_defs = (self .commands [bnum ],
1058
- self .commands_doprompt [bnum ],
1059
- self .commands_silent [bnum ])
1050
+ old_commands = self .commands [bnum ]
1060
1051
else :
1061
- old_command_defs = None
1052
+ old_commands = None
1062
1053
self .commands [bnum ] = []
1063
- self .commands_doprompt [bnum ] = True
1064
- self .commands_silent [bnum ] = False
1065
1054
1066
1055
prompt_back = self .prompt
1067
1056
self .prompt = '(com) '
@@ -1070,14 +1059,10 @@ def do_commands(self, arg):
1070
1059
self .cmdloop ()
1071
1060
except KeyboardInterrupt :
1072
1061
# Restore old definitions.
1073
- if old_command_defs :
1074
- self .commands [bnum ] = old_command_defs [0 ]
1075
- self .commands_doprompt [bnum ] = old_command_defs [1 ]
1076
- self .commands_silent [bnum ] = old_command_defs [2 ]
1062
+ if old_commands :
1063
+ self .commands [bnum ] = old_commands
1077
1064
else :
1078
1065
del self .commands [bnum ]
1079
- del self .commands_doprompt [bnum ]
1080
- del self .commands_silent [bnum ]
1081
1066
self .error ('command definition aborted, old commands restored' )
1082
1067
finally :
1083
1068
self .commands_defining = False
@@ -2093,7 +2078,7 @@ def complete_unalias(self, text, line, begidx, endidx):
2093
2078
2094
2079
# List of all the commands making the program resume execution.
2095
2080
commands_resuming = ['do_continue' , 'do_step' , 'do_next' , 'do_return' ,
2096
- 'do_quit' , 'do_jump' ]
2081
+ 'do_until' , ' do_quit' , 'do_jump' ]
2097
2082
2098
2083
# Print a traceback starting at the top stack frame.
2099
2084
# The most recently entered frame is printed last;
0 commit comments