RFR: 8319875: Add macOS implementation for jcmd System.map [v2]

Simon Tooke stooke at openjdk.org
Tue Oct 29 11:18:20 UTC 2024


On Tue, 29 Oct 2024 07:56:42 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Simon Tooke has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   changes from review
>
> src/hotspot/os/bsd/memMapPrinter_macosx.cpp line 79:
> 
>> 77:       char buf[PATH_MAX];
>> 78:       buf[0] = 0;
>> 79:       proc_regionfilename(getpid(), (uint64_t) _address, buf, sizeof(buf));
> 
> I'd probably guard after the API call, just to be sure, with `buf[sizeof(buf)-1] = '\0'`. I could not find a description of this API anywhere, so no idea what its rules about zero termination are when buffer overflows.

Good idea.

> src/hotspot/os/bsd/memMapPrinter_macosx.cpp line 101:
> 
>> 99:     if (valid_share_mode) {
>> 100:       int share_mode = rinfo.pri_share_mode;
>> 101:       //share_mode = share_mode == SM_LARGE_PAGE || share_mode == SM_PRIVATE_ALIASED ? SM_PRIVATE;
> 
> remnant?

gone.

> src/hotspot/os/bsd/memMapPrinter_macosx.cpp line 196:
> 
>> 194: 
>> 195:     bool is_private = region_info.pri_share_mode == SM_PRIVATE || region_info.pri_share_mode == SM_PRIVATE_ALIASED;
>> 196:     bool is_shared = region_info.pri_share_mode == SM_SHARED || region_info.pri_share_mode == SM_SHARED_ALIASED || region_info.pri_share_mode == SM_TRUESHARED || region_info.pri_share_mode == SM_COW;
> 
> give us a line break :-) ?

done.

> src/hotspot/os/bsd/memMapPrinter_macosx.cpp line 336:
> 
>> 334: }
>> 335: 
>> 336: #endif // __APPLE__
> 
> whitespace error?

Deleted line 335

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20953#discussion_r1820598566
PR Review Comment: https://git.openjdk.org/jdk/pull/20953#discussion_r1820602981
PR Review Comment: https://git.openjdk.org/jdk/pull/20953#discussion_r1820601728
PR Review Comment: https://git.openjdk.org/jdk/pull/20953#discussion_r1820598286


More information about the hotspot-runtime-dev mailing list