src/os/windows/vm/os_windows.cpp

Print this page

        

@@ -1418,10 +1418,13 @@
    return 0;
 }
 
 bool os::dll_address_to_library_name(address addr, char* buf,
                                      int buflen, int* offset) {
+  // buf is not optional, but offset is optional
+  assert(buf != NULL, "sanity check");
+
 // NOTE: the reason we don't use SymGetModuleInfo() is it doesn't always
 //       return the full path to the DLL file, sometimes it returns path
 //       to the corresponding PDB file (debug info); sometimes it only
 //       returns partial path, which makes life painful.
 

@@ -1433,23 +1436,26 @@
    if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) {
       // buf already contains path name
       if (offset) *offset = addr - mi.base_addr;
       return true;
    } else {
-      if (buf) buf[0] = '\0';
+      buf[0] = '\0';
       if (offset) *offset = -1;
       return false;
    }
 }
 
 bool os::dll_address_to_function_name(address addr, char *buf,
                                       int buflen, int *offset) {
+  // buf is not optional, but offset is optional
+  assert(buf != NULL, "sanity check");
+
   if (Decoder::decode(addr, buf, buflen, offset)) {
     return true;
   }
   if (offset != NULL)  *offset  = -1;
-  if (buf != NULL) buf[0] = '\0';
+  buf[0] = '\0';
   return false;
 }
 
 // save the start and end address of jvm.dll into param[0] and param[1]
 static int _locate_jvm_dll(int pid, char* mod_fname, address base_addr,