Improve recording of IA64 stack data.

Examination of the results from anole and gharial suggests that we're
only managing to track the size of one of the two stacks of IA64 machines.
Some googling gave the answer: on HPUX11, the register stack is reported
as a page type I don't see in pstat.h on my HPUX10 box.  Let's try
testing for that.
This commit is contained in:
Tom Lane 2016-07-09 15:00:22 -04:00
parent ea9c4a16d5
commit c57562725d

View File

@ -94,12 +94,14 @@ report_stack_size(void)
#if defined(__hpux) #if defined(__hpux)
/* HPUX: examine process's memory map with pstat_getprocvm() */ /* HPUX: examine process's memory map with pstat_getprocvm() */
int targetpid = getpid(); int targetpid = getpid();
struct pst_vm_status buf;
int res;
int ndx; int ndx;
for (ndx = 0;; ndx++) for (ndx = 0;; ndx++)
{ {
struct pst_vm_status buf;
const char *pagetype;
int res;
res = pstat_getprocvm(&buf, sizeof(buf), targetpid, ndx); res = pstat_getprocvm(&buf, sizeof(buf), targetpid, ndx);
if (res < 0) if (res < 0)
{ {
@ -108,13 +110,25 @@ report_stack_size(void)
} }
if (res != 1) if (res != 1)
break; break;
if (buf.pst_type != PS_STACK) switch (buf.pst_type)
{
case PS_STACK:
pagetype = "STACK";
break;
#ifdef PS_RSESTACK
case PS_RSESTACK:
pagetype = "REGSTACK";
break;
#endif
default:
continue; continue;
fprintf(stderr, "%d: stack addr 0x%lx, length %ld, physical pages %ld\n", }
fprintf(stderr, "%d: stack addr 0x%lx, length %ld, physical pages %ld, type %s\n",
targetpid, targetpid,
buf.pst_vaddr, buf.pst_vaddr,
buf.pst_length, buf.pst_length,
buf.pst_phys_pages); buf.pst_phys_pages,
pagetype);
} }
#else /* non HPUX */ #else /* non HPUX */
/* Otherwise: try to use pmap. No error if that doesn't work. */ /* Otherwise: try to use pmap. No error if that doesn't work. */