On Tue, 20 Aug 2024 06:36:26 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:
>> This is a port of [JDK-8318636](https://github.com/openjdk/jdk/pull/16301) >> to Windows. >> >> System.map and System.dump_map are implemented using the Windows API and >> provide roughly the same information in the same format. Most of the heavy >> lifting was implemented by @tstuefe in #16301 - this PR adds the Windows >> implementation and enables the common code for Windows 64 bit. >> >> [Sample output (with NMT >> enabled)](https://github.com/user-attachments/files/16663332/vm_memory_map_760.txt) > > src/hotspot/os/windows/memMapPrinter_windows.cpp line 98: > >> 96: buffer[idx++] = 'n'; >> 97: } else if (prot != 0) { >> 98: snprintf(buffer, bufsiz, "(0x%x)", prot); > > This could truncate for the longest possible value (16+4 chars). But (here and in other places) raw-printing the unknown constant may not be the best way. Chances are this code is executed rarely and most people will just be perplexed at the weird printouts. We could assert here: After all, we expect to handle all possible values; if we see an unknown constant, then we either have a bug in the code and what we read here is no protection value, or Microsoft added new constants. In both cases, a code fix is needed. Asserts would fire up in automatic regression tests. The alternative is to print an '?'. And possibly scan for that in regression tests too. I leave this decision up to you. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20597#discussion_r1722805594