Skip to content

Commit 14aa314

Browse files
committed
Sync list command...
Default style is better for 2.7
1 parent 0ca4158 commit 14aa314

2 files changed

Lines changed: 191 additions & 135 deletions

File tree

trepan/lib/default.py

Lines changed: 63 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2008-2009, 2013, 2015, 2017, 2020-2021 Rocky Bernstein
3-
# <rocky@gnu.org>
2+
#
3+
# Copyright (C) 2008-2009, 2013, 2015, 2017, 2020-2021, 2023-2024
4+
# Rocky Bernstein <rocky@gnu.org>
45
#
56
# This program is free software: you can redistribute it and/or modify
67
# it under the terms of the GNU General Public License as published by
@@ -17,93 +18,135 @@
1718
""" A place for the debugger default settings """
1819

1920
# External Egg packages
20-
import os, tracer
21-
from columnize import computed_displaywidth
21+
import os
2222

23+
import tracer
24+
from columnize import computed_displaywidth
2325
from term_background import is_dark_background
2426

2527
width = computed_displaywidth()
28+
is_dark_bg = is_dark_background()
29+
default_style = "zenburn" if is_dark_bg else "tango"
2630

2731
# Below are the default debugger settings. The debugger object version
2832
# of this may change. A setting is something a user may want to
2933
# change, in contrast to settings that the debugger decides to set in
3034
# the course of operation. For example, the maximum print width
3135
# (width) is user settable, whereas whether the debugging program is
32-
# running (execution_status), or traceback frame isn't user settable
33-
# so it doesn't appear below. Some settings like the current frame
36+
# running (execution_status), or traceback frame isn't user settable.
37+
# Therefore, it doesn't appear below. Some settings like the current frame
3438
# (curframe) or the number of steps to skip before entering a command
3539
# processor (step_ignore) are shared between the two. They also don't
3640
# generally appear as settings.
3741

42+
# fmt: off
3843
DEBUGGER_SETTINGS = {
3944
# Emacs and old-style gdb annotate level. Used to annotate output
4045
# to make parsing inside Emacs easier and to allow Emacs to get
4146
# updated information (stack, local variables) without having to
4247
# poll for it.
4348
"annotate": 0,
44-
# Format style to use in showing disssembly
49+
50+
# Format style to use in showing disassembly
4551
"asmfmt": "extended",
52+
4653
# Eval as Python the unrecognized debugger commands?
4754
"autoeval": True,
55+
4856
# Run 'list' command every time we enter the debugger?
4957
"autolist": False,
58+
5059
# Enter IPython every time we enter the debugger?
5160
# Note: only relevant if we have ipython installed. This takes
52-
# precidence over autopython.
61+
# precedence over autopython.
5362
"autoipython": False,
63+
64+
# Run 'info pc' command every time we enter the debugger?
65+
"autopc": False,
66+
5467
# Enter Python every time we enter the debugger?
5568
"autopython": False,
69+
5670
# Show basename only on filename output?
57-
# This opiton is useful in integration testing and
71+
# This option is useful in integration testing and
5872
# possibly to prepare example output for publication
5973
"basename": False,
74+
6075
# Set echoing lines read from debugger?
6176
"cmdtrace": False,
77+
6278
# confirm potentially dangerous operations?
6379
"confirm": True,
80+
6481
# Debug macros?
6582
"debugmacro": False,
83+
6684
# Debug the debugger?
6785
"dbg_trepan": False,
86+
6887
# When True, consecutive stops must be on different
6988
# file/line positions.
7089
"different": True,
90+
7191
# events is a set of events to process line-, call-, or return-like
7292
# tracing. See tracer.ALL_EVENT_NAMES and ALL_EVENTS
7393
# Note this is independent of printset which just prints the event.
7494
# This set controls entering the debugger command processor.
7595
"events": tracer.ALL_EVENTS,
96+
7697
# Use terminal highlight? Acceptable values are
7798
# 'plain' : no highlighting
7899
# 'dark' : terminal highlighting for a dark background
79100
# 'light' : terminal highlighting for a light background
80-
"highlight": is_dark_background(),
101+
"highlight": "dark" if is_dark_bg else "light",
102+
103+
# Where do we save the history?
104+
"histfile": None,
105+
81106
# Save debugger history?
82107
"hist_save": True,
108+
83109
# Show function calls/returns?
84110
"fntrace": False,
111+
85112
# Number of lines to show by default in a 'list' command.
86113
"listsize": 10,
114+
87115
# max length to show of parameter string
88116
"maxargstrsize": 100,
117+
89118
# max length to in other strings
90119
"maxstring": 150,
120+
91121
# printset is a set of events to print line-, call-, or return-like
92122
# tracing. See tracer.ALL_EVENT_NAMES and ALL_EVENTS. This only
93123
# has an effect if trace is set True.
94124
"printset": tracer.ALL_EVENTS,
95-
# If this is set True, debugger startup file, e.g. .trepanrc will
125+
126+
# If this is set True, debugger startup file, e.g. ".trepanrc" will
96127
# not be read/run.
128+
97129
"nostartup": False,
98130
# Reread source file if we determine it has changed?
131+
99132
"reload": False,
100-
# Stop at 'def' and 'class' statements?
133+
# Skip instructions that make classes, functions, and closures?
134+
# (In the Python they are "class" and "def" statements)
101135
"skip": True,
136+
137+
"step_ignore": 0,
138+
139+
# Pygments style. Style is ignored if "highlight" setting
140+
# is "plain"
141+
"style": default_style,
142+
102143
# Location to put temporary decompiled python files.
103144
# If value is None, use Python's defaults
104145
"tempdir": None,
146+
105147
# print trace output?
106148
"trace": False,
149+
107150
# The target maximum print length. Used for example in listing
108151
# arrays which are columnized.
109152
"width": width,
@@ -116,12 +159,13 @@
116159

117160

118161
SERVER_SOCKET_OPTS = {
119-
"HOST": None, # Symbolic name meaning all available interfaces
120-
"PORT": 1027, # Arbitrary non-privileged port
121-
"reuse": "posix" == os.name, # Allow port to be resued on close?
122-
"skew": +0, # additional increment on socket tries
162+
"HOST": None, # Symbolic name meaning all available interfaces
163+
"PORT": 1027, # Arbitrary non-privileged port
164+
"reuse": "posix" == os.name, # Allow port to be reused on close?
165+
"skew": +0, # additional increment on socket tries
123166
"search_limit": 100, # max number of ports to try
124167
}
168+
# fmt: on
125169

126170
# Default settings on the Debugger#start() method call
127171
START_OPTS = {
@@ -140,7 +184,8 @@
140184
import pprint
141185

142186
for val in ["DEBUGGER_SETTINGS", "START_OPTS", "STOP_OPTS"]:
143-
print("%s:\n" % val), pprint.pformat(eval(val))
144-
print
187+
print("%s:" % val)
188+
print(pprint.pformat(eval(val)))
189+
print("-" * 10)
145190
pass
146191
pass

0 commit comments

Comments
 (0)