Skip to content

Commit 8015fc1

Browse files
committed
apply patches for pypy
1 parent e2a40d8 commit 8015fc1

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

src/vmprof_common.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
#include <assert.h>
44
#include <errno.h>
55

6+
#ifdef RPYTHON_VMPROF
7+
#ifdef RPYTHON_LL2CTYPES
8+
/* only for testing: ll2ctypes sets RPY_EXTERN from the command-line */
9+
10+
#else
11+
# include "common_header.h"
12+
# include "structdef.h"
13+
# include "src/threadlocal.h"
14+
# include "rvmprof.h"
15+
# include "forwarddecl.h"
16+
#endif
17+
#endif
18+
19+
#ifdef VMP_SUPPORTS_NATIVE_PROFILING
20+
#include "vmp_stack.h" // reduces warings
21+
#endif
22+
23+
624
static volatile int is_enabled = 0;
725
static long prepare_interval_usec = 0;
826
static long profile_interval_usec = 0;

src/vmprof_getpc.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,21 @@ struct CallUnrollInfo {
131131
// typedef int ucontext_t;
132132
// #endif
133133

134-
#define GetPC(__SIGNAL_UCONTEXT) (NULL)
135-
//inline intptr_t GetPC(ucontext_t *signal_ucontext) {
136-
// // RAW_LOG(ERROR, "GetPC is not yet implemented on Windows\n");
137-
// fprintf(stderr, "GetPC is not yet implemented on Windows\n");
138-
// return NULL;
139-
//}
134+
static intptr_t GetPC(ucontext_t *signal_ucontext) {
135+
// RAW_LOG(ERROR, "GetPC is not yet implemented on Windows\n");
136+
fprintf(stderr, "GetPC is not yet implemented on Windows\n");
137+
return NULL;
138+
}
140139

141140
// Normal cases. If this doesn't compile, it's probably because
142141
// PC_FROM_UCONTEXT is the empty string. You need to figure out
143142
// the right value for your system, and add it to the list in
144143
// vmrpof_config.h
145144
#else
146145

147-
#define GetPC(__SIGNAL_UCONTEXT) (__SIGNAL_UCONTEXT->PC_FROM_UCONTEXT)
148-
//inline intptr_t GetPC(ucontext_t *signal_ucontext) {
149-
// return signal_ucontext->PC_FROM_UCONTEXT; // defined in config.h
150-
//}
146+
static intptr_t GetPC(ucontext_t *signal_ucontext) {
147+
return signal_ucontext->PC_FROM_UCONTEXT; // defined in config.h
148+
}
151149

152150
#endif
153151

src/vmprof_memory.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99

1010
static mach_port_t mach_task;
1111
#else
12+
#include <stdio.h>
1213
#include <stdlib.h>
1314
#include <sys/types.h>
1415
#include <sys/stat.h>
1516
#include <fcntl.h>
17+
#include <unistd.h>
18+
#include <string.h>
1619
/* On '''normal''' Unices we can get RSS from '/proc/<pid>/status'. */
1720
static int proc_file = -1;
1821
#endif

0 commit comments

Comments
 (0)