https://arcan-fe.com/2024/09/16/a-spreadsheet-and-a-debugger-walks-into-a-shell/ Arcan IRC: #arcan @ irc.libera.chat [header1] Skip to content * Home * About * Documentation * Videos * Code (Fossil) * Code (GitHub) * Social (Discord) - Cat9 Microdosing: Each and Contain A Spreadsheet and a Debugger walk into a Shell Posted on September 16, 2024 by bjornstahl Here we continue the series of posts on the development of a command-line shell which defies terminal emulation by using the display server API locally and a purpose built network protocol remotely. Previous episodes include: The Day of a new Command-Line Interface: Shell (high level) Whipping up a new Shell - Lash#Cat9 (technical demo), Cat9 Microdosing: Stash and List (feature highlight), Cat9 Microdosing: Each and Contain (feature highlight) For this round we have added an interactive spreadsheet representation and a Debug Adapter Protocol implementation. These come as two discrete sets of builtins (groups of commands), 'dev' and 'spreadsheet' with a surprise interaction or two. The intent for the dev builtin is to eventually collect more and more useful tools for managing all aspects of software development, from source control management to building, testing and fuzzing. Starting with the spreadsheet. By typing: builtin spreadsheet new You would get something like the following screenshot: [spread1] The following clip shows how I spawn new spreadsheet, populated by a CSV source and using the mouse cursor to interact with the layout. This complements the form intended for media processing that was presented a few years ago as "Pipeworld" and re-uses the same language and parsing logic. Cells can be populated with static contents, expressions like =max (A1:A4) or even shell commands through the ! prefix, e.g. !date +%Y:%M:%S. The following clip shows some basic expression use, as well as forced reprocessing of expressions and shell commands. Combining shell commands with expressions that are re-executed on request More useful is to populate the sheet with outputs from some command and processed by Lua patterns. The following screenshot shows the result of running insert #0 4 separate "%s+:" !cat /proc/cpuinfo [cpuinfo]Populating a spreadsheet at some insertion point using a shell command split and separated with Lua patterns Exporting can be done using the existing copy builtin with control over output format, subrange and so on: copy #4(csv, compact, a1:b5) to export the resolved values of a1,b1,a2,b2 ... as CSV. There is still more to be done for this to be a complete replacement for the likes of sc-im, and to add things like plotting via gnuplot (if I can ever get their plot language to behave) and graphviz, as well more experimental things like importing Makefiles - -- but at least for my, admittedly humble, spreadsheet uses it is good enough for daily driving. Onwards to the Debugger To start things you would do something like the following: builtin dev debug launch ./test The 'dev' builtin set is used as it will eventually accumulate all developer task related commands like building, deployment, source control management and so on. The following clip shows the default behaviour for that in action. In it you can see how multiple discrete jobs are created for managing threads, breakpoints and so on, detachable and with mouse cursor handling in place. Basic debugger use and navigation In the clip I also showed the process of stepping through threads, spawning source view, setting and toggling breakpoints, inspecting registers and modifying target variables. I have spent thousands of hours staring at the GDB CLI prompt, and hated nearly every second of it. Not because of the relaxing task of debugging code or exploring software state itself, but for the absolutely atrocious terminal thrashing interface even with mitigation layers such as pwndbg. In fairness, a debugger TUI is in the deepest end of the complexity pool to get going. There is a lot that goes into handling the protocol, and quite a few telltale signs of its designers, so we have just passed the point of basic bring-up. Importantly it is all composable with the data manipulation, filtering and transfer tools we already have elsewhere. As an example of that we have 'contain' from the previous article, for instance, to bunch all the subwindows together into one contained job, useful when running multiple debug sessions side by side to step through multi-process issues. We do have some other conveniences in place. Stepping controls are defined by the granularity of the job it represents, so stepping in the disassembly view would step instructions, while stepping in the source view would go by line or statement and so on. Now to close the loop and mix in the spreadsheet part. In the following clip you see me picking a few registers and thread source location that gets added to a watch set. Whenever thread execution is stopped, these will be resampled and updated. I then click the 'spreadsheet' option which will create a spreadsheet and populate it with the contents of the watchset as I go. Live mapping watched dataset to spreadsheet With all this in place we can almost start stitching the many other related projects together, from the data visualization from Senseye (closing in on 10 years...) with the window management from Pipeworld to the harnessing and setup from Leveraging the Display Server to Improve Debugging and build the panopticon of debugging from the plan presented in "Retooling and Securing Systemic Debugging" (2012, doi:10.1007/978-3-642-34210-3_10). But that is for another time. Share this: * Twitter * Facebook * Like Loading... Related About bjornstahl - View all posts by bjornstahl - This entry was posted in Uncategorized. Bookmark the permalink. - Cat9 Microdosing: Each and Contain Leave a comment Cancel reply [ ] [ ] [ ] [ ] [ ] [ ] [ ] D[ ] * Recent Posts + A Spreadsheet and a Debugger walk into a Shell September 16, 2024 + Cat9 Microdosing: Each and Contain August 5, 2024 + Cat9 Microdosing: Stash and List May 17, 2024 + Arcan 0.6.3 - I, pty: the fool December 19, 2023 + A12: Visions of the Fully Networked Desktop November 18, 2023 + The quest for a secure and accessible desktop June 15, 2023 + Whipping up a new Shell - Lash#Cat9 October 15, 2022 + Arcan 0.6.2 - It's all connected July 15, 2022 + The Day of a new Command-Line Interface: Shell April 2, 2022 + Arcan 0.6.1 November 19, 2021 + Arcan as Operating System Design September 20, 2021 + Introducing Pipeworld: Spreadsheet Dataflow Computing April 12, 2021 + Durden 0.6 Released December 20, 2020 + Arcan versus Xorg: Feature parity and Beyond December 3, 2020 + Arcan 0.6 - 'M' - Start Networking November 24, 2020 + A12 - Advancing Network Transparency on the Desktop October 28, 2020 + Leveraging the "Display Server" to Improve Debugging February 10, 2020 + Interfacing with a 'Stream Deck' Device October 30, 2019 + Another low-level Arcan client: A tray icon handler May 7, 2019 + Writing a low-level Arcan Client March 3, 2019 * Find Us Github IRC: #arcan @ libera.chat Discord Email: contact [at] arcan-fe.com * RSS + RSS - Posts * September 2024 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 << Aug Arcan Blog at WordPress.com. * Comment * Reblog * Subscribe Subscribed + [arcani] Arcan Join 25 other subscribers [ ] Sign me up + Already have a WordPress.com account? Log in now. * Privacy * + [arcani] Arcan + Customize + Subscribe Subscribed + Sign up + Log in + Copy shortlink + Report this content + View post in Reader + Manage subscriptions + Collapse this bar Loading Comments... Write a Comment... [ ] Email (Required) [ ] Name (Required) [ ] Website [ ] [Post Comment] %d [b]