On Sat, Apr 25, 2015, at 03:59 PM, Adam Wolk wrote: > Hi misc@ > > I'm working on a port for the Dart programming language - currently > trying to just > get some stuff just building before I start adding proper support. > > I started to hit code that uses ucontext.h which is not present on > OpenBSD. > > The first occurrence happened in dart/runtime/vm/signal_handler.h [1], > while handling it > I found out that signal.h defines sigcontext which has the same role as > mcontext_t > from ucontext.h. > > More serious (for me) issues happened with > dart/runtime/vm/signal_handler_linux.cc [2]. > Where the gregs field is being accessed from mcontext. This file however > seems to handle > 'UNIMPLEMENTED()' code paths so that's what I added so far to get the > build moving. > > Now I'm sitting at thread_interrupter_linux.cc which tries to obtain the > uc_mcontext from > mcontext_t and I don't see a way to obtain that information. > > Now again I will probably still just bump the compilation forward by > hacking the files in a really > ugly way but later on I want to add proper platform support - meaning > adding _openbsd.cc/h > files and integrating it into the build. > > So my question is, are there any alternatives that provide the same > functionality that's expected > from uc_mcontext and mcontext_t.gregs? How should I best approach this. > > I didn't involve upstream in the port yet (I will later on) & I'm not > expecting solution - a pointer > in the right direction would be deeply appreciated :) > > [1] - > https://github.com/dart-lang/bleeding_edge/blob/master/dart/runtime/vm/signal_handler.h > [2] - > https://github.com/dart-lang/bleeding_edge/blob/master/dart/runtime/vm/signal_handler_linux.cc > [3] - > https://github.com/dart-lang/bleeding_edge/blob/master/dart/runtime/vm/thread_interrupter_linux.cc > > Regards, > -- > Adam Wolk > adam.w...@koparo.com >
Taking a look at sigaction it seems that the fields defined there match values provided by uc_mcontext/.gregs. Am I correct thinking that sigaction.sc_rip matches uc_mcontext.gregs[REG_RIP] etc. I'm going to test that path and sorry for hitting the list before giving this a try, though still appreciate any feedback if I'm going the wrong way. Regards, Adam