[Vala] How to use vala Linux.backtrace?
- From: Christian Johnson <_c_ mail com>
- To: vala-list gnome org
- Subject: [Vala] How to use vala Linux.backtrace?
- Date: Wed, 27 Nov 2013 22:27:10 +0000 (UTC)
Hey!
I'm trying to print out stacktrace, Linux.backtrace and
Linux.backtrace_symbols look like they would work but them being part of
libc I can't seam to discover how to use them from vala. The GNU manual has
this example:
void *array[10];
size_t size;
char **strings;
size_t i;
size = backtrace (array, 10);
strings = backtrace_symbols (array, size);
printf ("Obtained %zd stack frames.\n", size);
for (i = 0; i < size; i++)
printf ("%s\n", strings[i]);
free (strings);
So trying to convert this to vala:
void[] array = new void[10];
int size = Linux.backtrace (&array, 10);
string[] strings = Linux.backtrace_symbols (array, size);
foreach (string trace in strings) {
stdout.printf("%s\n", trace);
}
This produces the fallow error:
*** Error in `valac': munmap_chunk(): invalid pointer: 0xb76d1069 ***
So...What am I doing wrong?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]