Antonio Cuni avatar Antonio Cuni committed 99740e7

show the frame index in the same line as the filename, just because I like it more :)

Comments (0)

Files changed (2)

                        self.curindex)
         frame, lineno = frame_lineno
         if frame is self.curframe:
-            print >>self.stdout, ('[%d]\n>' % frame_index),
+            print >>self.stdout, ('[%d] >' % frame_index),
         else:
-            print >>self.stdout, ('[%d]\n ' % frame_index),
+            print >>self.stdout, ('[%d]  ' % frame_index),
         print >>self.stdout, self.format_stack_entry(frame_lineno,
                                                      prompt_prefix)
 

testing/test_pdb.py

         return a+b+c
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> a = 1
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> b = 2
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> c = 3
 # c
 """)
         nested()
 
     check(fn, """
-[NUM]
-> .*nested()
+[NUM] > .*nested()
 -> return
 # up
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> nested()
 # xx
 42
         return
 
     check(a, """
-[38]
-> .*c()
+[38] > .*c()
 -> return
 # f 36
-[36]
-> .*a()
+[36] > .*a()
 -> b()
 # c
 """)
         return
 
     check(a, """
-[38]
-> .*c()
+[38] > .*c()
 -> return
 # up 3
-[35]
-> .*runpdb()
+[35] > .*runpdb()
 -> func()
 # down 1
-[36]
-> .*a()
+[36] > .*a()
 -> b()
 # c
 """)
         return c
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return c
 # c
 42
         return args
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return args
 # args
 42
         return a
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return a
 # ll
 NUM         def fn():
         return a
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> b = 1
 # display a
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> a = 2
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> a = 3
 a: 1 --> 2
 # undisplay a
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return a
 # c
 """)
         return b
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> b = 42
 # display b
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return b
 b: <undefined> --> 42
 # c
         return a
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> a = 1
 # sticky
 CLEAR>.*
 NUM             c = 3
 NUM             return a
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> b = 2
 CLEAR>.*
 
 NUM             return a
 # sticky
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> c = 3
 # c
 """)
     end = lineno + 3
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> a = 1
 # sticky %d %d
 CLEAR>.*
         return a
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> a = 1
 CLEAR>.*
 
             xpm()
 
     check(fn, """
-[NUM]
-> .*bar()
+[NUM] > .*bar()
 -> assert False
 # u
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> bar()
 # ll
 NUM         def fn():
             pdb.post_mortem(Pdb=PdbTest)
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> 1/0
 # c
 """)
             xpm()
 
     check(fn, """
-[NUM]
-> .*gen()
+[NUM] > .*gen()
 -> assert False
 # u
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> for i in gen():
 # c
 """)
     
     exec src.compile()
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return x
 # ll
 NUM     def fn():
         return bar()
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return bar()
 # source bar
 NUM         def bar():
         return 42
 
     check(fn, r"""
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 42
 # source 42
 \*\* Error: .* is not a module, class, method, function, traceback, frame, or code object \*\*
         filename = filename[:-1]
     
     check(fn, r"""
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 42
 # edit
 RUN emacs \+%d '%s'
 """ % (return42_lineno, filename))
 
     check(bar, r"""
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 42
 # up
-[NUM]
-> .*bar()
+[NUM] > .*bar()
 -> fn()
 # edit
 RUN emacs \+%d '%s'
         filename = filename[:-1]
 
     check(fn, r"""
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 42
 # edit bar
 RUN emacs \+%d '%s'
         filename = filename[:-1]
     #
     check(bar, """
-[NUM]
-> .*bar()
+[NUM] > .*bar()
 -> return 42
 # edit bar
 RUN emacs \+%d '%s'
     start_lineno = lineno + 1
 
     check(fn, r"""
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 42
 # x = 10
 # y = 12
     start_lineno = lineno + 1
 
     check(fn, r"""
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> if False: g()
 # g()
 hello world
     start_lineno = lineno + 3
 
     check(fn, r"""
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return x
 # x = 10
 # y = 12
     start_lineno = lineno + 2
 
     check(fn, r"""
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 42
 # x
 10
         return x
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return x
 # x
 2
         return 1
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> g()
    1 frame hidden .*
 # down
 ... Newest frame
 # hf_unhide
 # down
-[NUM]
-> .*g()
+[NUM] > .*g()
 -> return 'foo'
 # up
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> g()
 # hf_hide        ### hide the frame again
 # down
         return 1
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> g()
    1 frame hidden .*
 # hf_unhide
 # down           ### now the frame is no longer hidden
-[NUM]
-> .*g()
+[NUM] > .*g()
 -> return 'foo'
 # hf_hide        ### hide the current frame, go to the top of the stack
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> g()
 # c
 """)
         k()
         return 1
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> k()
    2 frames hidden .*
 # hf_list
         return 1
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> k()
    2 frames hidden .*
 # hf_list
         return g()
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return g()
    1 frame hidden .*
 # hf_list
         return 1
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> g()
 # c           ### note that the hidden frame count is not displayed
 """)
         return 1
 
     check(fn, """
-[NUM]
-> .*g()
+[NUM] > .*g()
 -> return 'foo'
 # c           ### note that we were inside g()
 """)
         return obj.x
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> obj.x = 0
    1 frame hidden .*
 # hasattr(obj, 'x')
 False
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return obj.x
 # print obj.x
 0
         return obj.x
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> obj.x = 42
    1 frame hidden .*
 # obj.x
 0
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return obj.x
 # obj.x
 42
         a.bar = 42
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> a.bar = 42
    1 frame hidden .*
 # c
         return obj.x
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> obj.x = 0
    1 frame hidden .*
 # obj.y
 # hasattr(obj, 'x')
 False
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return obj.x
 # print obj.x
 1
         return 42
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 42
 # track
 ... SyntaxError:
         return 1
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 1
 # debug g()
 ENTERING RECURSIVE DEBUGGER
-[NUM]
-> .*
+[NUM] > .*
 (#) s
 --Call--
-[NUM]
-> .*g()
+[NUM] > .*g()
 -> def g():
 (#) ll
 NUM  ->     def g():
         return 1
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> return 1
 HOOK!
 # c
         return
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> x = "this is plan ascii"
 # n
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> y = "this contains a unicode: à"
 # c
 """)
     line_z = lineno+4
 
     check(fn, """
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> x = 1
 # c %d
 Breakpoint 1 at .*/test_pdb.py:%d
 Deleted breakpoint 1
-[NUM]
-> .*fn()
+[NUM] > .*fn()
 -> z = 3
 # c
 """ % (line_z, line_z))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.