#How to use valgrind with rust

13 messages · Page 1 of 1 (latest)

storm sandal
#

I always get ```
$ valgrind target/debug/sugar-lang
==928135== Memcheck, a memory error detector
==928135== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==928135== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==928135== Command: target/debug/sugar-lang
==928135==

unhandled dwarf2 abbrev form code 0x25

unhandled dwarf2 abbrev form code 0x25

unhandled dwarf2 abbrev form code 0x25

unhandled dwarf2 abbrev form code 0x1b

==928135== Valgrind: debuginfo reader: ensure_valid failed:
==928135== Valgrind: during call to ML_(img_get)
==928135== Valgrind: request for range [310935713, +4) exceeds
==928135== Valgrind: valid image size of 122189496 for image:
==928135== Valgrind: "/mnt/7BE462B403C20D04/Coding Shit/Rust/Act1Scratch/sugar-lang/target/debug/sugar-lang"
==928135==
==928135== Valgrind: debuginfo reader: Possibly corrupted debuginfo file.
==928135== Valgrind: I can't recover. Giving up. Sorry.
==928135==```

#

How to use valgrind with rust

crude echo
#

seems like no one really knows about valgrind with rust, so you might want to ask something more general about what you want to do. There might be a more common option specific to rust? @storm sandal

storm sandal
#

in the past I could do it with valgrind

crude echo
#

Maybe miri?

storm sandal
#

does it work like valgrind

crude echo
#

Im not very familiar with either valgrind or miri myself but it seems like miri would be able to catch exactly what problem causes the segfault

#

As far as ive understood, miri is the primary tool for automatically finding UB things in rust

storm sandal
#

it can not call foreign function

crude echo
#

I dont know if there is a way to work around that except for mocking the api maybe