about summary refs log tree commit diff
path: root/src/rt/rust.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rt/rust.cpp')
-rw-r--r--src/rt/rust.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index 76cef811e75..c487bee954c 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -24,12 +24,14 @@ command_line_args : public kernel_owned<command_line_args>
         LPCWSTR cmdline = GetCommandLineW();
         LPWSTR *wargv = CommandLineToArgvW(cmdline, &argc);
         kernel->win32_require("CommandLineToArgvW", wargv != NULL);
-        argv = (char **) kernel->malloc(sizeof(char*) * argc);
+        argv = (char **) kernel->malloc(sizeof(char*) * argc,
+                                        "win32 command line");
         for (int i = 0; i < argc; ++i) {
             int n_chars = WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1,
                                               NULL, 0, NULL, NULL);
             kernel->win32_require("WideCharToMultiByte(0)", n_chars != 0);
-            argv[i] = (char *) kernel->malloc(n_chars);
+            argv[i] = (char *) kernel->malloc(n_chars,
+                                              "win32 command line arg");
             n_chars = WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1,
                                           argv[i], n_chars, NULL, NULL);
             kernel->win32_require("WideCharToMultiByte(1)", n_chars != 0);
@@ -38,14 +40,14 @@ command_line_args : public kernel_owned<command_line_args>
 #endif
         size_t vec_fill = sizeof(rust_str *) * argc;
         size_t vec_alloc = next_power_of_two(sizeof(rust_vec) + vec_fill);
-        void *mem = kernel->malloc(vec_alloc);
-        args = new (mem) rust_vec(task->sched, vec_alloc, 0, NULL);
+        void *mem = kernel->malloc(vec_alloc, "command line");
+        args = new (mem) rust_vec(vec_alloc, 0, NULL);
         rust_str **strs = (rust_str**) &args->data[0];
         for (int i = 0; i < argc; ++i) {
             size_t str_fill = strlen(argv[i]) + 1;
             size_t str_alloc = next_power_of_two(sizeof(rust_str) + str_fill);
-            mem = kernel->malloc(str_alloc);
-            strs[i] = new (mem) rust_str(task->sched, str_alloc, str_fill,
+            mem = kernel->malloc(str_alloc, "command line arg");
+            strs[i] = new (mem) rust_str(str_alloc, str_fill,
                                          (uint8_t const *)argv[i]);
         }
         args->fill = vec_fill;
@@ -106,7 +108,8 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
     kernel->start();
     rust_scheduler *sched = kernel->get_scheduler();
     command_line_args *args
-        = new (kernel) command_line_args(sched->root_task, argc, argv);
+        = new (kernel, "main command line args")
+        command_line_args(sched->root_task, argc, argv);
 
     DLOG(sched, dom, "startup: %d args in 0x%" PRIxPTR,
              args->argc, (uintptr_t)args->args);