Skip to content

Commit 030d9b6

Browse files
committed
Add process ID retrieval and enhance test output; configure VSCode settings
1 parent da2b86f commit 030d9b6

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"files.associations": {
3+
"*.ejs": "html",
4+
"memtool.h": "c"
5+
}
6+
}

test_main.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,34 @@
22
#include <stdio.h>
33
#include "memtool.h"
44

5+
#include "memtool.h"
6+
7+
process_id_t get_process_id() {
8+
#ifdef PLATFORM_WINDOWS
9+
return GetCurrentProcessId();
10+
#else
11+
return getpid();
12+
#endif
13+
}
14+
15+
516
void test_open_process() {
6-
process_id_t pid = 1; // Example PID
17+
printf("Testing open_process...\n");
18+
//grab own process id
19+
process_id_t pid = get_process_id();
20+
printf("PID: %d\n", pid);
721
ProcessHandle* handle = open_process(pid);
22+
printf("Handle: %p\n", handle);
823
assert(handle != NULL);
924
close_process(handle);
1025
}
1126

1227
void test_read_process_maps() {
13-
process_id_t pid = 1; // Example PID
28+
printf("Testing read_process_maps...\n");
29+
process_id_t pid = get_process_id();
30+
printf("PID: %d\n", pid);
1431
ProcessMap* map = read_process_maps(pid);
32+
printf("Map: %p\n", map);
1533
assert(map != NULL);
1634
free(map);
1735
}

0 commit comments

Comments
 (0)