Update 2023-09-05 11:55 OpenBSD/amd64-x13

This commit is contained in:
c0dev0id 2023-09-05 11:55:13 +01:00
parent fff63f11b3
commit a442d37d55
5 changed files with 123 additions and 58 deletions

View File

@ -12,7 +12,7 @@ _ports=$(find \
-maxdepth 1 \ -maxdepth 1 \
| grep -v -E distfiles\|pobj\|plist\|CVS) | grep -v -E distfiles\|pobj\|plist\|CVS)
_sys=$(find /usr/src/* /usr/src/sys/* -type d -maxdepth 0 \ _sys=$(find /usr/src/*/* -type d -maxdepth 0 \
| grep -v -E distfiles\|pobj\|plist\|CVS) | grep -v -E distfiles\|pobj\|plist\|CVS)
_system=\ _system=\

132
.gdbinit
View File

@ -6,7 +6,7 @@ python
# License ---------------------------------------------------------------------- # License ----------------------------------------------------------------------
# Copyright (c) 2015-2022 Andrea Cardaci <cyrus.and@gmail.com> # Copyright (c) 2015-2023 Andrea Cardaci <cyrus.and@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -650,7 +650,8 @@ class Dashboard(gdb.Command):
# process all the init files in order # process all the init files in order
for root, dirs, files in itertools.chain.from_iterable(inits_dirs): for root, dirs, files in itertools.chain.from_iterable(inits_dirs):
dirs.sort() dirs.sort()
for init in sorted(files): # skipping dotfiles
for init in sorted(file for file in files if not file.startswith('.')):
path = os.path.join(root, init) path = os.path.join(root, init)
_, ext = os.path.splitext(path) _, ext = os.path.splitext(path)
# either load Python files or GDB # either load Python files or GDB
@ -674,8 +675,19 @@ class Dashboard(gdb.Command):
@staticmethod @staticmethod
def create_command(name, invoke, doc, is_prefix, complete=None): def create_command(name, invoke, doc, is_prefix, complete=None):
Class = type('', (gdb.Command,), {'invoke': invoke, '__doc__': doc}) if callable(complete):
Class(name, gdb.COMMAND_USER, complete or gdb.COMPLETE_NONE, is_prefix) Class = type('', (gdb.Command,), {
'__doc__': doc,
'invoke': invoke,
'complete': complete
})
Class(name, gdb.COMMAND_USER, prefix=is_prefix)
else:
Class = type('', (gdb.Command,), {
'__doc__': doc,
'invoke': invoke
})
Class(name, gdb.COMMAND_USER, complete or gdb.COMPLETE_NONE, is_prefix)
@staticmethod @staticmethod
def err(string): def err(string):
@ -697,7 +709,7 @@ class Dashboard(gdb.Command):
# ANSI: move the cursor to top-left corner and clear the screen # ANSI: move the cursor to top-left corner and clear the screen
# (optionally also clear the scrollback buffer if supported by the # (optionally also clear the scrollback buffer if supported by the
# terminal) # terminal)
return '\x1b[H\x1b[J' + '\x1b[3J' if R.discard_scrollback else '' return '\x1b[H\x1b[2J' + ('\x1b[3J' if R.discard_scrollback else '')
@staticmethod @staticmethod
def setup_terminal(): def setup_terminal():
@ -1647,46 +1659,53 @@ Optionally list the frame arguments and locals too.'''
# skip if the current thread is not stopped # skip if the current thread is not stopped
if not gdb.selected_thread().is_stopped(): if not gdb.selected_thread().is_stopped():
return [] return []
# find the selected frame (i.e., the first to display) # find the selected frame level (XXX Frame.level() is a recent addition)
selected_index = 0 start_level = 0
frame = gdb.newest_frame() frame = gdb.newest_frame()
while frame: while frame:
if frame == gdb.selected_frame(): if frame == gdb.selected_frame():
break break
frame = frame.older() frame = frame.older()
selected_index += 1 start_level += 1
# format up to "limit" frames # gather the frames
frames = []
number = selected_index
more = False more = False
while frame: frames = [gdb.selected_frame()]
# the first is the selected one going_down = True
selected = (len(frames) == 0) while True:
# fetch frame info # stack frames limit reached
style = R.style_selected_1 if selected else R.style_selected_2 if len(frames) == self.limit:
frame_id = ansi(str(number), style) more = True
info = Stack.get_pc_line(frame, style)
frame_lines = []
frame_lines.append('[{}] {}'.format(frame_id, info))
# add frame arguments and locals
variables = Variables.format_frame(
frame, self.show_arguments, self.show_locals, self.compact, self.align, self.sort)
frame_lines.extend(variables)
# add frame
frames.append(frame_lines)
# next
frame = frame.older()
number += 1
# check finished according to the limit
if self.limit and len(frames) == self.limit:
# more frames to show but limited
if frame:
more = True
break break
# zigzag the frames starting from the selected one
if going_down:
frame = frames[-1].older()
if frame:
frames.append(frame)
else:
frame = frames[0].newer()
if frame:
frames.insert(0, frame)
start_level -= 1
else:
break
else:
frame = frames[0].newer()
if frame:
frames.insert(0, frame)
start_level -= 1
else:
frame = frames[-1].older()
if frame:
frames.append(frame)
else:
break
# switch direction
going_down = not going_down
# format the output # format the output
lines = [] lines = []
for frame_lines in frames: for number, frame in enumerate(frames, start=start_level):
lines.extend(frame_lines) selected = frame == gdb.selected_frame()
lines.extend(self.get_frame_lines(number, frame, selected))
# add the placeholder # add the placeholder
if more: if more:
lines.append('[{}]'.format(ansi('+', R.style_selected_2))) lines.append('[{}]'.format(ansi('+', R.style_selected_2)))
@ -1729,6 +1748,19 @@ Optionally list the frame arguments and locals too.'''
} }
} }
def get_frame_lines(self, number, frame, selected=False):
# fetch frame info
style = R.style_selected_1 if selected else R.style_selected_2
frame_id = ansi(str(number), style)
info = Stack.get_pc_line(frame, style)
frame_lines = []
frame_lines.append('[{}] {}'.format(frame_id, info))
# add frame arguments and locals
variables = Variables.format_frame(
frame, self.show_arguments, self.show_locals, self.compact, self.align, self.sort)
frame_lines.extend(variables)
return frame_lines
@staticmethod @staticmethod
def format_line(prefix, line): def format_line(prefix, line):
prefix = ansi(prefix, R.style_low) prefix = ansi(prefix, R.style_low)
@ -1985,6 +2017,10 @@ class Registers(Dashboard.Module):
changed = self.table and (self.table.get(name, '') != string_value) changed = self.table and (self.table.get(name, '') != string_value)
self.table[name] = string_value self.table[name] = string_value
registers.append((name, string_value, changed)) registers.append((name, string_value, changed))
# handle the empty register list
if not registers:
msg = 'No registers to show (check the "dashboard registers -style list" attribute)'
return [ansi(msg, R.style_error)]
# compute lengths considering an extra space between and around the # compute lengths considering an extra space between and around the
# entries (hence the +2 and term_width - 1) # entries (hence the +2 and term_width - 1)
max_name = max(len(name) for name, _, _ in registers) max_name = max(len(name) for name, _, _ in registers)
@ -2036,7 +2072,8 @@ class Registers(Dashboard.Module):
'list': { 'list': {
'doc': '''String of space-separated register names to display. 'doc': '''String of space-separated register names to display.
The empty list (default) causes to show all the available registers.''', The empty list (default) causes to show all the available registers. For
architectures different from x86 setting this attribute might be mandatory.''',
'default': '', 'default': '',
'name': 'register_list', 'name': 'register_list',
} }
@ -2137,7 +2174,7 @@ class Expressions(Dashboard.Module):
'''Watch user expressions.''' '''Watch user expressions.'''
def __init__(self): def __init__(self):
self.table = set() self.table = []
def label(self): def label(self):
return 'Expressions' return 'Expressions'
@ -2148,7 +2185,7 @@ class Expressions(Dashboard.Module):
if self.align: if self.align:
label_width = max(len(expression) for expression in self.table) if self.table else 0 label_width = max(len(expression) for expression in self.table) if self.table else 0
default_radix = Expressions.get_default_radix() default_radix = Expressions.get_default_radix()
for expression in self.table: for number, expression in enumerate(self.table, start=1):
label = expression label = expression
match = re.match('^/(\d+) +(.+)$', expression) match = re.match('^/(\d+) +(.+)$', expression)
try: try:
@ -2161,9 +2198,10 @@ class Expressions(Dashboard.Module):
finally: finally:
if match: if match:
run('set output-radix {}'.format(default_radix)) run('set output-radix {}'.format(default_radix))
number = ansi(str(number), R.style_selected_2)
label = ansi(expression, R.style_high) + ' ' * (label_width - len(expression)) label = ansi(expression, R.style_high) + ' ' * (label_width - len(expression))
equal = ansi('=', R.style_low) equal = ansi('=', R.style_low)
out.append('{} {} {}'.format(label, equal, value)) out.append('[{}] {} {} {}'.format(number, label, equal, value))
return out return out
def commands(self): def commands(self):
@ -2175,8 +2213,7 @@ class Expressions(Dashboard.Module):
}, },
'unwatch': { 'unwatch': {
'action': self.unwatch, 'action': self.unwatch,
'doc': 'Stop watching an expression.', 'doc': 'Stop watching an expression by index.'
'complete': gdb.COMPLETE_EXPRESSION
}, },
'clear': { 'clear': {
'action': self.clear, 'action': self.clear,
@ -2195,15 +2232,22 @@ class Expressions(Dashboard.Module):
def watch(self, arg): def watch(self, arg):
if arg: if arg:
self.table.add(arg) if arg not in self.table:
self.table.append(arg)
else:
raise Exception('Expression already watched')
else: else:
raise Exception('Specify an expression') raise Exception('Specify an expression')
def unwatch(self, arg): def unwatch(self, arg):
if arg: if arg:
try: try:
self.table.remove(arg) number = int(arg) - 1
except: except:
number = -1
if 0 <= number < len(self.table):
self.table.pop(number)
else:
raise Exception('Expression not watched') raise Exception('Expression not watched')
else: else:
raise Exception('Specify an expression') raise Exception('Specify an expression')

View File

@ -1,9 +1,7 @@
# auto generated by GDB dashboard dashboard -layout !assembly breakpoints !expressions !history !memory !registers threads stack variables source
dashboard source -style height 32
dashboard -layout !assembly breakpoints !expressions !history !memory !registers threads stack source !variables
dashboard source -style height 22
dashboard variables -style compact False dashboard variables -style compact False
dashboard -style compact_values
dashboard -style dereference
set confirm off set confirm off
set disassembly-flavor intel set disassembly-flavor intel

31
.kshrc
View File

@ -198,9 +198,16 @@ alias pkg_info="\pkg_info ${PKGOPT}"
pkg_reset() { pkg_delete -cIX $(</home/sdk/.pkglist); } pkg_reset() { pkg_delete -cIX $(</home/sdk/.pkglist); }
# servers # servers
x() { ssh -t home.codevoid.de 'tmux -u attach || tmux -u'; } x() { printf '\033]0;$ ssh home.codevoid.de\007' \
t() { ssh -t tweety.dhcp.codevoid.de 'tmux -u attach || tmux -u'; } && ssh -t home.codevoid.de 'tmux -u attach || tmux -u'; }
o() { ssh -t openbsd.codevoid.de 'tmux -u attach || tmux -u'; }
t() { printf '\033]0;$ ssh tweety.home.codevoid.de\007' \
&& ssh -t -J home.codevoid.de \
tweety.home.codevoid.de 'tmux -u attach || tmux -u'; }
o() { printf '\033]0;$ ssh cvs.openbsd.org\007' \
&& ssh -t -J home.codevoid.de \
cvs.openbsd.org 'tmux -u attach || tmux -u'; }
scr() { [ -z "$1" ] && doas wsconsctl -n display.brightness \ scr() { [ -z "$1" ] && doas wsconsctl -n display.brightness \
|| doas wsconsctl display.brightness="$1"; } || doas wsconsctl display.brightness="$1"; }
@ -245,7 +252,7 @@ pw() { pwgen -1 -y --remove-chars=\~\`\"\'{}\(\)\[\]\*.\;\|,\<\> 22; }
alias tarsnap="doas \tarsnap" alias tarsnap="doas \tarsnap"
# archives # archives
alias innoextract="\innoextract -g --no-gog-galaxy" alias innoextract="\innoextract -g"
alias wget-mirror="wget --mirror --page-requisites --html-extension --convert-links" alias wget-mirror="wget --mirror --page-requisites --html-extension --convert-links"
@ -384,6 +391,13 @@ cvs-sync-sunny() {
rsync -arv --delete /usr/xenocara/ root@sunny:/usr/xenocara/ rsync -arv --delete /usr/xenocara/ root@sunny:/usr/xenocara/
} }
set_autoconf() {
set -x
export AUTOMAKE_VERSION=1.16
export AUTOCONF_VERSION=2.69
set +x
}
# PORTS # PORTS
portclean() {( portclean() {(
cd /usr/ports cd /usr/ports
@ -430,6 +444,15 @@ openbsd-gitupdate() {
cd ~/code/OpenBSD cd ~/code/OpenBSD
} }
# mygdb <breakpoint> <program> <arguments>
mygdb() {
[ -z $3 ] \
&& echo "mygdb <breakpoint> <program> <arguments>" \
&& return
break="$1"; shift; prog="$1"; shift; args="$@";
egdb -ex "break $break" -ex "run $args" $prog
}
######################################################################## ########################################################################
# KERNEL STUFF # KERNEL STUFF
######################################################################## ########################################################################

View File

@ -1,5 +1,7 @@
let g:netrw_dirhistmax =10 let g:netrw_dirhistmax =10
let g:netrw_dirhistcnt =0 let g:netrw_dirhistcnt =2
let g:netrw_dirhist_2='/home/sdk/.cache/mutt'
let g:netrw_dirhist_1='/home/dpb/usr/ports/games/devilutionx'
let g:netrw_dirhist_0='/usr/local/share/doc/crispy-strife' let g:netrw_dirhist_0='/usr/local/share/doc/crispy-strife'
let g:netrw_dirhist_9='/usr/local/share/doc/crispy-hexen' let g:netrw_dirhist_9='/usr/local/share/doc/crispy-hexen'
let g:netrw_dirhist_8='/usr/local/share/doc/crispy-heretic' let g:netrw_dirhist_8='/usr/local/share/doc/crispy-heretic'
@ -8,5 +10,3 @@ let g:netrw_dirhist_6='/home/sdk'
let g:netrw_dirhist_5='/home/sdk/.config' let g:netrw_dirhist_5='/home/sdk/.config'
let g:netrw_dirhist_4='/home/sdk/satzung' let g:netrw_dirhist_4='/home/sdk/satzung'
let g:netrw_dirhist_3='/usr/xenocara/lib/libva' let g:netrw_dirhist_3='/usr/xenocara/lib/libva'
let g:netrw_dirhist_2='/home/dpb/usr/ports/mystuff/net/gurk-rs/files'
let g:netrw_dirhist_1='/etc/X11/xenodm'