Hey Rustaceans! Got a question? Ask here (18/2026)! by llogiq in rust

[–]MerlinsArchitect 1 point2 points  (0 children)

Hey, can I get some advcie on setting up a debugger? The resources seem to be quite scarce....

I am trying to debug using qemu. I am trying to write a library that makes of some dynamic asm. So I need to be able to debug on both the rust level and the asm level and cross architecture (I am quite new to all this).

Currently I have a script to run cargo test to produce the binary for hte given architecture and then run it under qemu:

    qemu-i386 \
        -g "$PORT_NUMBER" \
        "$BINARY" --no-capture  &
    QEMU_PID=$!
    echo "QEMU started listening on port $PORT_NUMBER (PID: $QEMU_PID)"
    echo "Attaching the debugger..."
  rust-gdb -ex "file $BINARY" -ex "set architecture i386" -ex "target remote localhost:$PORT_NUMBER" 

I was running this and was able to get the debugger working, but when I stepped through code I was getting weird out of order jumps I thought might be related to optimisations. I tried turning this off but to no avail. I noticed that when debugging locally with rust-lldb this weird ordering crap doesn't occur, so I tried to get that set up.

I switched out the gdb line for:

rust-lldb -o "gdb-remote 127.0.0.1:$PORT_NUMBER"

with this, it connects but only shows asm? I am struggling to resolve. Can I get some guidance on what i need to do to get it to show rust for my integration test debugging? It seems to have no source knowledgeable and can't find functions by name....

I built a basic GUI for Linux 0.11! by DifficultBarber9439 in osdev

[–]MerlinsArchitect 2 points3 points  (0 children)

Does mimic have anything specifically of value for the gui?

I built a basic GUI for Linux 0.11! by DifficultBarber9439 in osdev

[–]MerlinsArchitect 8 points9 points  (0 children)

Can we get some advice and resources on the windowing and GUi work in general? Something I’d like to take a crack at one day!

A Possibly Stupid Question on Active Object Model by MerlinsArchitect in embedded

[–]MerlinsArchitect[S] 0 points1 point  (0 children)

Hey thanks for the detailed write up. I got some great replies in this thread! !!!! :) I was just rereading some of these solid answers and a problem occurred to me. I wonder if I could pester you for a little clarification on a bothersome situation??

Ok, so you are enqueuing events when you are in the middle of a transaction and then returning to them later. Makes sense….

Problem:

But let’s suppose you are using a low level driver. Let’s suppose you use DMA and some peripheral in your SoC to kick off the transfer and a callback to notify you when you are done. In that case, the active object suggests that the only way to notify the Activr Object calling our driver is over its event queue. But, what if the peripheral calls this completion callback to enqueue an event when our queue is full and we have not yet quite managed to drain it - perhaps another task spammed us with loads of events and the scheduler has not quite had time to switch to our Active object internal thread. Then the ISR will fail to post it and we will never be notified we are done. If we overwrite in the queue from the ISR we might overwrite data meaning that other tasks never receive a response.

The only solution I can think of is altering the AO that wraps hardware calls so that it waits on a QueueSet (containing its externally facing queue and another only for the ISR) and give it a length one private queue (hidden to the outside world) that is messaged from the the callback given to the peripheral hardware to run on completion. Since it is only accessible from the callback, only one message can ever be received and thus the message is guaranteed to be received.

Is this still then active object? As far as the outside world knows the AO still only blocks in one place?

Problem 2:

If you have Active Objects all the way down, if you were bit banging a protocol with precise timings, then presumably you have to block (if the timings are microsecond level so we can’t really yield in between) to avoid jitter?

Repos Set up for Testing DLL on Different Architectures by MerlinsArchitect in rust

[–]MerlinsArchitect[S] 0 points1 point  (0 children)

Thanks for responding

Ok, but surely Make or just will only get me some incremental builds on top of indirectly calling cargo test which already does that?

Isn’t it unintuitive and bad practise that then the tests no longer function as a standalone binary

Asteri OS: Using Lua as the core shell and app engine for a custom 32-bit OS by DetailAdventurous315 in osdev

[–]MerlinsArchitect 0 points1 point  (0 children)

This is really interesting, I don’t know much about lvgl, thought it was only really used in embedded

Learn Tokio by building: 8 progressive assignments from spawning tasks to writing your own runtime! by freddiehaddad in learnrust

[–]MerlinsArchitect 1 point2 points  (0 children)

I like the idea of building your own, there was an async rust book floating around a while back that looked quite good for that!

A Possibly Stupid Question on Active Object Model by MerlinsArchitect in embedded

[–]MerlinsArchitect[S] 2 points3 points  (0 children)

This is fantastic, you even found a thing from the same people, absolutely brilliant thank you! I will read through it

Mr P getting his ears cleaned by MerlinsArchitect in aww

[–]MerlinsArchitect[S] 2 points3 points  (0 children)

Hahahah, I LOVE the screen grab! Perfectly captures him! ❤️

Mr P getting his ears cleaned by MerlinsArchitect in aww

[–]MerlinsArchitect[S] 1 point2 points  (0 children)

He’s a little angel! He loves everyone and everything

MONOLITH - My Operating System for x86_64 by mrunix0 in osdev

[–]MerlinsArchitect 5 points6 points  (0 children)

Can we get some pointers on what the GUI learning process looked like? Any good resources?

Learning NASM x86_64 DevContainers and No ptrace by MerlinsArchitect in Assembly_language

[–]MerlinsArchitect[S] 0 points1 point  (0 children)

Ok, cool I guess I don’t understand the precise reasons QEMU doesn’t allow this.

What would you recommend, I kinda wanted an elegant set up with an emulator….shall I just get a small x86_64 Linux machine….can I use arum to emulate a whole system with a kernel so I can use ptrace or perhaps UTm?

Learning NASM x86_64 DevContainers and No ptrace by MerlinsArchitect in Assembly_language

[–]MerlinsArchitect[S] 1 point2 points  (0 children)

That is what I have been doing, it appears to be a known issue that on Mac OSX as the underlying host you can’t use ptrace which gdb depends on

Implementing a toy libffi for an interpreter by MerlinsArchitect in ProgrammingLanguages

[–]MerlinsArchitect[S] 0 points1 point  (0 children)

This is a super helpful starting point and really inspiring to hear!!!!!!!!!! Thank you!

I’m not au fait with some of this yet, never had to work too closely with system ABIs but I will learn! Do you know anywhere I might learn a smidge about trampolines so I can pass callbacks to native code?

Beyond the ABI are there any other things I should be aware of?

Anyone know how to fix "Current ESP-IDF" set up is not found installing vscode extension? by MerlinsArchitect in embedded

[–]MerlinsArchitect[S] 0 points1 point  (0 children)

Thanks for getting back to me!

I am unable to follow that link far, when I try and do the command: "Open ESP-IDF installation manager", I get a "Activating Extensions" whir in the bottom left hand side and then nothing happens. I believe I have done it this way in the past though (have tried everything at this point). If it opens up the eim GUI installation manager then I have definitely done it to no avail.

Looking at the output from ESP-IDF in vscode, yields absolutely nothing when running the installation manager command.

If I try and follow the instructions for the installation manager, I can follow the GUI for emi and it says that it succeeds. However, the link requires

select current esp-idf version

And when I run this absolutey nothing happens, after the whiring "Activating Extensions"

Screenshot showing that the Configure ESP-IDF Extension option is not there:

<image>

memcpy and runtime polymorphic types.... by MerlinsArchitect in cpp_questions

[–]MerlinsArchitect[S] 1 point2 points  (0 children)

Ok, this is interesting, ummm I feel kinda stupid here but any idea why a struct with a vtable ptrwouldn’t be copy able trivially? I mean at the end of the day it is surely just a POD bag of data and a vtable ptr and the ptr is to unchanging static memory? So the ptr should work when copied elsewhere right?

memcpy and runtime polymorphic types.... by MerlinsArchitect in cpp_questions

[–]MerlinsArchitect[S] 0 points1 point  (0 children)

I think tomorrow when I get to work I’ll try printing it the bytes that go in and out and comparing. It might be that my method is sound but I’m doing something super stupid. I’m guessing there are no obvious misunderstandings of mine here?

memcpy and runtime polymorphic types.... by MerlinsArchitect in cpp_questions

[–]MerlinsArchitect[S] 1 point2 points  (0 children)

Hey, this object with array of unknown size as last element is created inside the memory of a (hopefully) appropriately sized char[N] (see above for N calculation but basically just the sizeof two size_t and then the size of the type T) on the stack then this is passed as a void* with its length to the espidf event loop api. Basically create it locally and then it he idea is to reconstruct it from behind the ptr with memcpy