src/jdk.hotspot.agent/macosx/native/libsaproc/ps_core.c
branchihse-remove-mapfiles-branch
changeset 56109 5bf57be44328
parent 47216 71c04702a3d5
child 56721 01b558efd286
equal deleted inserted replaced
56108:88838a55535b 56109:5bf57be44328
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   891   lseek(fd, pos, SEEK_SET);
   891   lseek(fd, pos, SEEK_SET);
   892   return is_macho;
   892   return is_macho;
   893 }
   893 }
   894 
   894 
   895 // the one and only one exposed stuff from this file
   895 // the one and only one exposed stuff from this file
   896 struct ps_prochandle* Pgrab_core(const char* exec_file, const char* core_file) {
   896 JNIEXPORT struct ps_prochandle*
       
   897 Pgrab_core(const char* exec_file, const char* core_file) {
   897   mach_header_64 core_header;
   898   mach_header_64 core_header;
   898   mach_header_64 exec_header;
   899   mach_header_64 exec_header;
   899 
   900 
   900   struct ps_prochandle* ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle));
   901   struct ps_prochandle* ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle));
   901   if (ph == NULL) {
   902   if (ph == NULL) {
  1423 
  1424 
  1424   return true;
  1425   return true;
  1425 }
  1426 }
  1426 
  1427 
  1427 // the one and only one exposed stuff from this file
  1428 // the one and only one exposed stuff from this file
  1428 struct ps_prochandle* Pgrab_core(const char* exec_file, const char* core_file) {
  1429 JNIEXPORT struct ps_prochandle*
       
  1430 Pgrab_core(const char* exec_file, const char* core_file) {
  1429   ELF_EHDR core_ehdr;
  1431   ELF_EHDR core_ehdr;
  1430   ELF_EHDR exec_ehdr;
  1432   ELF_EHDR exec_ehdr;
  1431 
  1433 
  1432   struct ps_prochandle* ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle));
  1434   struct ps_prochandle* ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle));
  1433   if (ph == NULL) {
  1435   if (ph == NULL) {