> Gesendet: Montag, 05. April 2021 um 22:05 Uhr > Von: "Alexander Tormasov via users" <[email protected]> > An: "Genode users mailing list" <[email protected]> > Cc: "Alexander Tormasov" <[email protected]> > Betreff: Re: how to open elf file image from inside genode? libbacktrace > question > First let me tell sorry for the spellchecker ran amok in my last post. It smuggled the ist into two instances of static to create statistic. Please ignore the contraband.
Now that I was able to look into the library source I can give you a recipe. 1) Define a number that is used as descriptor next 2) On startup dup2() the capability (possibly after casting to a POSIX Descriptor) to the defined number 3) In fileline.c introduce a last option of using the empty filename "" 4) In posix.c in function backtrace_open () check for empty filename 5) If so, blindly dup() the defined number. If successful return the created (By dup()) handle. If error you can either declare failure or try first to really open () the (empty) filename. > >> or I need to modify it and add another «double» option, something like > >> > > You need this configuration. But why do you want to use a way that > > is dependent upon config, when you need it for a language detail. That is > > why make > > something compiled in depend on something configured. And why has it to be > > POSIX > > open ()? Alternatively you can store that capability on startup in a static > > var in > > open () where it is returned from upon encountering a special parameter > > combination > > for instance an empty string as filename. > > of course, I would prefer to be able to use posix open (or even just obtain a > dup() of handle for my own executable file) to use it for read()/write() > operations later. > This is not mine code (libbacktrace is a part of original gcc), and I just > want to be able to run it maximally smoothly inside genode. > In this moment it try to call posix open() for some names like /proc/self/exe > or similar, and later returned handle used deeply inside code. > I will be happy to find ANY smooth way to have a handle for myself… > > and, I am not so sure that loaded into ram current executable is suitable for > such operations like read of elf header… probably I need to open it > explicitly, but to do so I need to find it inside genode file system mounted > name space (/vfs?) > > > > _______________________________________________ > Genode users mailing list > [email protected] > https://lists.genode.org/listinfo/users _______________________________________________ Genode users mailing list [email protected] https://lists.genode.org/listinfo/users
