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 \
| 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)
_system=\

132
.gdbinit
View File

@ -6,7 +6,7 @@ python
# 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
# 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
for root, dirs, files in itertools.chain.from_iterable(inits_dirs):
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)
_, ext = os.path.splitext(path)
# either load Python files or GDB
@ -674,8 +675,19 @@ class Dashboard(gdb.Command):
@staticmethod
def create_command(name, invoke, doc, is_prefix, complete=None):
Class = type('', (gdb.Command,), {'invoke': invoke, '__doc__': doc})
Class(name, gdb.COMMAND_USER, complete or gdb.COMPLETE_NONE, is_prefix)
if callable(complete):
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
def err(string):
@ -697,7 +709,7 @@ class Dashboard(gdb.Command):
# ANSI: move the cursor to top-left corner and clear the screen
# (optionally also clear the scrollback buffer if supported by the
# 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
def setup_terminal():
@ -1647,46 +1659,53 @@ Optionally list the frame arguments and locals too.'''
# skip if the current thread is not stopped
if not gdb.selected_thread().is_stopped():
return []
# find the selected frame (i.e., the first to display)
selected_index = 0
# find the selected frame level (XXX Frame.level() is a recent addition)
start_level = 0
frame = gdb.newest_frame()
while frame:
if frame == gdb.selected_frame():
break
frame = frame.older()
selected_index += 1
# format up to "limit" frames
frames = []
number = selected_index
start_level += 1
# gather the frames
more = False
while frame:
# the first is the selected one
selected = (len(frames) == 0)
# 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)
# 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
frames = [gdb.selected_frame()]
going_down = True
while True:
# stack frames limit reached
if len(frames) == self.limit:
more = True
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
lines = []
for frame_lines in frames:
lines.extend(frame_lines)
for number, frame in enumerate(frames, start=start_level):
selected = frame == gdb.selected_frame()
lines.extend(self.get_frame_lines(number, frame, selected))
# add the placeholder
if more:
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
def format_line(prefix, line):
prefix = ansi(prefix, R.style_low)
@ -1985,6 +2017,10 @@ class Registers(Dashboard.Module):
changed = self.table and (self.table.get(name, '') != string_value)
self.table[name] = string_value
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
# entries (hence the +2 and term_width - 1)
max_name = max(len(name) for name, _, _ in registers)
@ -2036,7 +2072,8 @@ class Registers(Dashboard.Module):
'list': {
'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': '',
'name': 'register_list',
}
@ -2137,7 +2174,7 @@ class Expressions(Dashboard.Module):
'''Watch user expressions.'''
def __init__(self):
self.table = set()
self.table = []
def label(self):
return 'Expressions'
@ -2148,7 +2185,7 @@ class Expressions(Dashboard.Module):
if self.align:
label_width = max(len(expression) for expression in self.table) if self.table else 0
default_radix = Expressions.get_default_radix()
for expression in self.table:
for number, expression in enumerate(self.table, start=1):
label = expression
match = re.match('^/(\d+) +(.+)$', expression)
try:
@ -2161,9 +2198,10 @@ class Expressions(Dashboard.Module):
finally:
if match:
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))
equal = ansi('=', R.style_low)
out.append('{} {} {}'.format(label, equal, value))
out.append('[{}] {} {} {}'.format(number, label, equal, value))
return out
def commands(self):
@ -2175,8 +2213,7 @@ class Expressions(Dashboard.Module):
},
'unwatch': {
'action': self.unwatch,
'doc': 'Stop watching an expression.',
'complete': gdb.COMPLETE_EXPRESSION
'doc': 'Stop watching an expression by index.'
},
'clear': {
'action': self.clear,
@ -2195,15 +2232,22 @@ class Expressions(Dashboard.Module):
def watch(self, arg):
if arg:
self.table.add(arg)
if arg not in self.table:
self.table.append(arg)
else:
raise Exception('Expression already watched')
else:
raise Exception('Specify an expression')
def unwatch(self, arg):
if arg:
try:
self.table.remove(arg)
number = int(arg) - 1
except:
number = -1
if 0 <= number < len(self.table):
self.table.pop(number)
else:
raise Exception('Expression not watched')
else:
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 source !variables
dashboard source -style height 22
dashboard -layout !assembly breakpoints !expressions !history !memory !registers threads stack variables source
dashboard source -style height 32
dashboard variables -style compact False
dashboard -style compact_values
dashboard -style dereference
set confirm off
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); }
# servers
x() { ssh -t home.codevoid.de 'tmux -u attach || tmux -u'; }
t() { ssh -t tweety.dhcp.codevoid.de 'tmux -u attach || tmux -u'; }
o() { ssh -t openbsd.codevoid.de 'tmux -u attach || tmux -u'; }
x() { printf '\033]0;$ ssh home.codevoid.de\007' \
&& ssh -t home.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 \
|| doas wsconsctl display.brightness="$1"; }
@ -245,7 +252,7 @@ pw() { pwgen -1 -y --remove-chars=\~\`\"\'{}\(\)\[\]\*.\;\|,\<\> 22; }
alias tarsnap="doas \tarsnap"
# archives
alias innoextract="\innoextract -g --no-gog-galaxy"
alias innoextract="\innoextract -g"
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/
}
set_autoconf() {
set -x
export AUTOMAKE_VERSION=1.16
export AUTOCONF_VERSION=2.69
set +x
}
# PORTS
portclean() {(
cd /usr/ports
@ -430,6 +444,15 @@ openbsd-gitupdate() {
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
########################################################################

View File

@ -1,5 +1,7 @@
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_9='/usr/local/share/doc/crispy-hexen'
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_4='/home/sdk/satzung'
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'