ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
ivche_ has joined #rust-embedded
ivche has quit [Ping timeout: 252 seconds]
ivche_ is now known as ivche
loki_val has joined #rust-embedded
limpkin has quit [Ping timeout: 252 seconds]
crabbedhaloablut has quit [Ping timeout: 252 seconds]
limpkin has joined #rust-embedded
pcs38 has joined #rust-embedded
pcs38 has quit [Quit: leaving]
PhilMarkgraf[m] has quit [Quit: Idle timeout reached: 172800s]
danielb[m] has quit [Quit: Idle timeout reached: 172800s]
sroemer has joined #rust-embedded
sroemer has quit [Changing host]
sroemer has joined #rust-embedded
<Ralph[m]> reading the past few messages i wonder if it wouldn't be a nice bachelor/master thesis for someone to analyse and figure out the best way to optimize power consumption for various use-cases with embedded rust (and of course provide PRs to embassy, RTIC, etc. to make this easier). just putting this out there for the people in this chat which work at universities and might have the chance to actually float this as a thesis idea 😉
RobinMueller[m] has quit [Quit: Idle timeout reached: 172800s]
<thejpster[m]> Can / should we make the various WG teams into "Teams" within github.com/rust-lang? Then you could ping them with an @.
<thejpster[m]> list of current teams: https://github.com/orgs/rust-lang/teams?
<JamesMunns[m]> There's some stuff going on with teams right now too, maybe good to do both at the same time?
Foxyloxy has quit [Read error: Connection reset by peer]
Foxyloxy has joined #rust-embedded
pcs38 has joined #rust-embedded
jason-kairos[m] has joined #rust-embedded
<jason-kairos[m]> How do you generate debug symbols for dependencies?
<JamesMunns[m]> the compiler should always do this if you have debug enabled
<JamesMunns[m]> like the debug field of your profile
<JamesMunns[m]> you can additionally set overrides for dependencies:
<jason-kairos[m]> maybe lto or something might be eliminating my dependancies as separate entities?
<JamesMunns[m]> are your dependencies in your workspace? or crates-io deps?
<JamesMunns[m]> It could also be hubris' build process doing something? I don't have any experience with it.
<JamesMunns[m]> lto can mess with debuginfo in my experience, as well
<jason-kairos[m]> Almost all in workspace, but a few are crates.io
<jason-kairos[m]> You are probably right, I does a lot of "magic" in the build system. It easily could be state
<jason-kairos[m]> s/I/It/, s/state/case/
<JamesMunns[m]> Also: the package override only applies to non-workspace deps
<JamesMunns[m]> also note that generics can make "which profile is used" a little complicated to answer: https://doc.rust-lang.org/cargo/reference/profiles.html#overrides-and-generics
<jason-kairos[m]> (In my case, I'm just trying to see the source of the panic handler for hubris)
<thejpster[m]> hubris, IIRC, is an RTOS that compiles each task as a binary, links everything, works out how big it all is, then links it again with the perfect amount of memory allocated
<JamesMunns[m]> workspace packages should follow profile.release settings
<jason-kairos[m]> * for hubris, it can be built with different settings per binary)
<JamesMunns[m]> thejpster[m]: yeah, it's possible they don't retain/preserve debuginfo correctly, but you'd have to open an issue with them
<thejpster[m]> so, "binary" is complicated when talking about Hubris. Are you talking about the kernel, or a task, or the combination of the kernel and all the tasks?
<jason-kairos[m]> When I debug, the binary is the combination. And I have to load in the debug symbols from the separate object files before it combines the two
<thejpster[m]> in terms of panics, I expect each task to have its own panic handler, which reports to the kernel that the task did a panic. The kernel will then restart the task.
<jason-kairos[m]> Yes, each one is unique. But lacking debug symbols.
<thejpster[m]> I don't think you can load debug symbols from object files? The debugger will need to know which address each symbol has and object code is from before address allocation.
<thejpster[m]> you could probably load debug symbols from the ELF file created for each task, as long as its from after the final memory allocation not before.
<thejpster[m]> Sorry, I've never tried to do what you're doing so I don't have good answers.
<thejpster[m]> You probably need Cliff.
<jason-kairos[m]> (which I am already doing effectively)
<thejpster[m]> OK those look like ELF files. Worth checking their symbol tables to make sure they are what you expect.
<JamesMunns[m]> but also if their re-linker pulls things out and re-links them, I don't expect stuff like addr2line to work correctly
<JamesMunns[m]> (but yeah, the hubris folks aren't terribly active here, you'll probably have to ping them elsewhere for them to see it)
<jason-kairos[m]> s/expend/expect/
<jason-kairos[m]> That seems like a "simpler" problem - although, I confess I don't actually know how gdb finds/guesses the source code paths in the first place
<jason-kairos[m]> For normal rust programs - isn't viewing dependency sources in the debugger also a "problem" ?
<thejpster[m]> There are no dependencies any more once you have a binary. There are symbols, which have an address, and there is debug information which maps machine code addresses back to regions of source code.
<JamesMunns[m]> <thejpster[m]> "See https://rust-training...." <- btw is there a reason you picked "Task" as a general term here, vs "threads" or "apps"? TockOS calls them capsules, zephyr calls them threads, rtems does seem to call them tasks, I think freertos might also call them tasks
<jason-kairos[m]> hubris calls them tasks
<JamesMunns[m]> <thejpster[m]> "See https://rust-training...." <- "Task" just has a different meaning in Rust, specifically.
<thejpster[m]> James Munns: only that is the term I prefer to use.
<thejpster[m]> What does Task mean in Rust terms?
<JamesMunns[m]> https://doc.rust-lang.org/stable/std/task/index.html, "Tasks" are what the executor deals in for async/await
<thejpster[m]> oh, ugh
<thejpster[m]> names are hard
<JamesMunns[m]> For sure, wasn't criticizing, just wondering
<thejpster[m]> I've been calling these things tasks in C for ~15 years.
<JamesMunns[m]> (and there are definitely RTOSs that call their "managed execution units" Tasks)
<thejpster[m]> I should add explanatory notes to head off any confusion;.
<thejpster[m]> I didn't want to use Thread because that has a specific meaning in POSIX, and a different meaning in Windows.
<JamesMunns[m]> (in async/await, the executor is the runtime, it manages tasks (and the reactor), and tasks manage futures)
<jason-kairos[m]> Is there some easy way to examine the debug symbol -> source mappings?
<JamesMunns[m]> addr2line is the opposite of that: code address to source mapping
<JamesMunns[m]> dunno how you do the opposite direction
<jason-kairos[m]> gdb does it somehow, and it almost works 50% of the time
<diondokter[m]> jason-kairos[m]: I'd use `nm`
<JamesMunns[m]> I'd imagine gdb does *something* morally equivalent to addr2line, but I really have no idea
<JamesMunns[m]> like, look at the program counter, lookup the current line, map that to debuginfo
<jason-kairos[m]> $ nm -l -C target/kairos-ngcmio/dist/default/test
<jason-kairos[m]> 08012cbd t core::panicking::panic_fmt/rustc/c52c23b6f44cd19718721a5e3b2eeb169e9c96ff/library/core/src/panicking.rs:54
<jason-kairos[m]> hmm... so my program is in `/hubris`
<jason-kairos[m]> not sure about this `/rustc` business
<jason-kairos[m]> I guess it might be sometime in the /target build directory structure
<JamesMunns[m]> /rustc is the mapping of the pre-built std library
<jason-kairos[m]> s/sometime/somewhere/, s///`//, s//`/
<jason-kairos[m]> oh... so I think I read I need to build std from scratch to see this
<jason-kairos[m]> I don't like that sound of that
<jason-kairos[m]> I'd bet optimization got rid of the library calls between `main` and the guts of the `panic` handling routines
<jason-kairos[m]> well, I think I've got a better understanding of what I'm looking at.
<jason-kairos[m]> I have to go a few instructions further to where my panic passes it's string to the kernel to find what I'm looking for
<thejpster[m]> you can tell gdb that "Hey, that /rustc/foo stuff can be found at ~buggles/Documents/project"
<jason-kairos[m]> I'd very much like to configure that
<jason-kairos[m]> I guess I just need to poke around in the ~/.cargo to try to find c52c23b6f44cd19718721a5e3b2eeb169e9c96ff
<jason-kairos[m]> I think I've seen something about path substitution in other gdb scripts
<JamesMunns[m]> that's the tagged release for 1.86.0, as far as I can see
<JamesMunns[m]> so the prebuilt rlib for std (core) for your target for 1.86.0
<JamesMunns[m]> idk
<jason-kairos[m]> bookmarked
<jason-kairos[m]> it worked
<jason-kairos[m]> that's going to make my debugging experience way more pleasant
<jason-kairos[m]> and now single stepping actually takes me directly to the hubris userspace libraries that handle panicking (in a way that is configurable and possibly different per program)
<jason-kairos[m]> thank you again everyone, I don't think I would have thought that of all things was the issue (I'd have thought that I could still breakpoint inside of userlib::panic without this)
<jason-kairos[m]> * thank you again everyone, I don't think I would have suspect that this of all things was the issue (I'd have thought that I could still breakpoint inside of userlib::panic without this)
<jason-kairos[m]> * thank you again everyone, I don't think I would have suspected that this of all things was the issue (I'd have thought that I could still breakpoint inside of userlib::panic without this)
SosthneGudon[m] has quit [Quit: Idle timeout reached: 172800s]
<jason-kairos[m]> The idea being that one sets a breakpoint on it and inspects the argument
<JamesMunns[m]> core::hint::black_box is stable I'm pretty sure
<jason-kairos[m]> now that I think about it, it would probably have to be a macro. In which case, it's probably not worth the effort.
pcs38 has quit [Remote host closed the connection]
<thejpster[m]> how do you mean optimised out? Arguments are passed by the caller, according to the parameter list, and I don't think there's anything a function body can do to stop a caller from passing them.
<thejpster[m]> Unless it's all inlined, but you've expressly prevented that.
<jason-kairos[m]> despite the #[inline(never)] and the body being just a asm::nop() gdb reports the arguments the to function being clobbered unless I specifically perform a read_volatile() on each function argument
<jason-kairos[m]> (optimized out, not clobbered)
<jason-kairos[m]> (ie. I set a breakpoint in gdb, and can't read the args)
<thejpster[m]> Oh I see. I suspect they are there, gdb is just telling you they aren't. But if the function was non-empty, locals could be stored in whatever register was used to pass the arguments you aren't using.
<jason-kairos[m]> You are right, sometimes. Other times, it almost seems like the compiler "knew" the arguments were not uses, and so nothing valid got passed into the registers to start with (I might be fooling myself, but I'm pretty sure I've seen it go both ways)
<jason-kairos[m]> s/uses/used/
<jason-kairos[m]> * You are right, sometimes. Other times, it almost seems like the compiler "knew" the arguments were not used, and so (seemingly) nothing valid gets passed into the registers to start with (I might be fooling myself, but I'm pretty sure I've seen it go both ways)
<thejpster[m]> I would be surprised to find that call sites were being optimised based on the function being called (unless you are using LTO, in which case yeah, perhaps it can do that).
RobinMueller[m] has joined #rust-embedded
<RobinMueller[m]> Who do I need to ping for MSP430 issues again? ^^ i found a really weird issue yesterday when using the 32bit multiplier support. I was wondering if anyone else has used it and encountered issues as well. I still need to compare the actual compiler output and create a clean minimum working example, but maybe i am not the first one..
<RobinMueller[m]> * multiplier support via compiler flag. I
<JamesMunns[m]> @cr1901
<RobinMueller[m]> * multiplier support via compiler flag, leading to odd system behaviour/crashes. I
Amit[m] has quit [Quit: Idle timeout reached: 172800s]
MartinSivk[m] has quit [Quit: Idle timeout reached: 172800s]
sroemer has quit [Quit: WeeChat 4.4.3]
pcs38 has joined #rust-embedded
lanre[m] has quit [Quit: Idle timeout reached: 172800s]
rmsyn[m] has quit [Quit: Idle timeout reached: 172800s]
newam[m] has quit [Quit: Idle timeout reached: 172800s]
bartmassey[m] has quit [Quit: Idle timeout reached: 172800s]
pbsds35 has quit [Quit: The Lounge - https://thelounge.chat]
pbsds35 has joined #rust-embedded
burrbull[m] has quit [Quit: Idle timeout reached: 172800s]
adamgreig[m] has quit [Quit: Idle timeout reached: 172800s]
jannic[m] has quit [Quit: Idle timeout reached: 172800s]
<RobinMueller[m]> It's a MSP430FR5994, so I assumed 32bit mul support should work
ouilemur has quit [Quit: WeeChat 4.6.2]
ouilemur has joined #rust-embedded
pcs38 has quit [Quit: leaving]
<cr1901> RobinMueller[m]: I don't think I've ever used the multiplier peripherals, opting for software mul; it may well be a backend bug. I'd need to see an MCVE
kit[m] has quit [Quit: Idle timeout reached: 172800s]
HumanG331 has quit [Ping timeout: 276 seconds]
HumanG331 has joined #rust-embedded