This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

varargs for decoding stack frames ?


Hi,

I'm search for a solution for decoding of calls stacks. I just wonder
whether varargs are suitable for this kind of task.

eg, would this be somewhat correct:

  void a(void *this, int a, float b) {
    printf("a is %i, b is %g", a, b);
  }

  void genericStoreMethod(void *this) {
    va_list va;
    va_start(va, this);
    if (this->signature = VOID__INT_FLOAT) {
      this->arg1 = va_arg(int);
      this->arg2 = va_arg(float);
    }
    va_end(va);
  }

  this->a = a;
  this->delayedA = (void (*)(void*))storeMethod;

  this->delayedA(this, 100, 200.0);
  // later call a by constructing stackframe via libffi

or do varargs only work with '...' style 'real' varargs ?

If not, does anyone know a package for doing this (like libffi but the
reverse way) ?

Thanks,
  Helge


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]