Skip to content

Instantly share code, notes, and snippets.

Created April 11, 2012 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2362471 to your computer and use it in GitHub Desktop.
Save anonymous/2362471 to your computer and use it in GitHub Desktop.
saghul@win7dev /c/Users/saghul/src/libuv
$ gdb ./test-uptime.exe
GNU gdb (GDB) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from c:\Users\saghul\src\libuv\test-uptime.exe...done.
(gdb) run
Starting program: c:\Users\saghul\src\libuv\test-uptime.exe
[New Thread 3552.0xf20]
[New Thread 3552.0xe14]
Program received signal SIGSEGV, Segmentation fault.
0x00401d80 in uv_uptime (uptime=0x22ff18) at src/win/util.c:432
432 if (counterDef->CounterNameTitleIndex == 674) {
(gdb) bt
#0 0x00401d80 in uv_uptime (uptime=0x22ff18) at src/win/util.c:432
#1 0x004013d1 in main (argc=1, argv=0x3c1160) at test_uptime.c:10
(gdb) f 0
#0 0x00401d80 in uv_uptime (uptime=0x22ff18) at src/win/util.c:432
432 if (counterDef->CounterNameTitleIndex == 674) {
(gdb) print counterDef
$1 = (PERF_COUNTER_DEFINITION *) 0xbaea17a5
(gdb) print counterDef->CounterNameTitleIndex
Cannot access memory at address 0xbaea17a9
(gdb)
#include <uv.h>
#include <stdio.h>
/* Compiled lime this: gcc -Iinclude -Iinclude/uv-private -Iinclude -Iinclude/uv-private -g --std=gnu89 -D_WIN32_WINNT=0x0600 -Isrc/ares/config_win32 -D_GNU_SOURCE -o test-uptime test_uptime.c uv.a -lws2_32 -lpsapi -liphlpapi -lm
*/
int main(int argc, char **argv)
{
double uptime;
uv_err_t err;
err = uv_uptime(&uptime);
if (err.code == UV_OK) {
printf("-- UPTIME: %f\n", uptime);
} else {
printf("-- UPTIME ERROR: %d\n", err.code);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment