Bug 3408 - fcore Prspinfo does not print out args and missing termination character
Summary: fcore Prspinfo does not print out args and missing termination character
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Yong Zheng
URL:
Keywords:
Depends on:
Blocks: 2243
  Show dependency treegraph
 
Reported: 2006-10-22 22:52 UTC by Phil Muldoon
Modified: 2006-11-21 18:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Muldoon 2006-10-22 22:52:25 UTC
I think the PRSPINFO section has some small bugs. I does not print out the args
of the process, and it does not terminate properly. See below examples. Notice
that the seperation between PRSPINFO and PRSTATUS is not correct.

On a fcore generated core file:

Note segment of 300 bytes at offset 0x394:
  Owner          Data size  Type
  CORE                 124  PRPSINFO
    state: T (84),  zombie: 49,  nice: 48
    flags: 00402000,  uid: 500,  gid: 500
    pid: 3085,  ppid: 3082,  pgrp: 3085,  sid: 3085
    fname: bash
     args:   CORE                 144  PRSTATUS
    SIGINFO:  signo: 0, code = 0, errno = 0
    signal: 0, pending: 00000000, holding:        0
    pid: 3085, ppid = 3082, pgrp = 3085, sid = 3085
     utime:      0.000000s,  stime:      0.000000s
    cutime:      0.000000s, cstime:      0.000000s
    eax: fffffe00  ebx: 00000000  ecx: bfb65fbb  edx: 00000001
    esi: 00b72420  edi: bfb65fbb  ebp: bfb65fc8  esp: bfb65f94
    eip: 00187402  eflags: 00200246  original eax: 00000003
    cs: 0073  ds: 007b  es: 007b  fs: 0000  gs: 0033  ss: 007b

on a gcore generated core file:

Note segment of 1132 bytes at offset 0x394:
  Owner          Data size  Type
  CORE                 124  PRPSINFO
    state:  (0),  zombie: 0,  nice: 0
    flags: 00000000,  uid: 0,  gid: 0
    pid: 0,  ppid: 0,  pgrp: 0,  sid: 0
    fname: bash
     args: /bin/bash 

  CORE                 144  PRSTATUS
    SIGINFO:  signo: 0, code = 0, errno = 0
    signal: 0, pending: 00000000, holding:        0
    pid: 3085, ppid = 0, pgrp = 0, sid = 0
     utime:      0.000000s,  stime:      0.000000s
    cutime:      0.000000s, cstime:      0.000000s
    eax: fffffe00  ebx: 00000000  ecx: bfb65fbb  edx: 00000001
    esi: 00b72420  edi: bfb65fbb  ebp: bfb65fc8  esp: bfb65f94
    eip: 00187402  eflags: 00200246  original eax: 00000003
    cs: 0073  ds: 007b  es: 007b  fs: 0000  gs: 0033  ss: 007b
Comment 1 Yong Zheng 2006-10-23 12:34:23 UTC
2006-10-23  Yong Zheng  <zhengyo@cn.ibm.com>

        * FCore.java (fillENotePrstatus): Set registers for PPC/PPC64.
        (fillENotePrpsinfo): Modify the end index of the byte[].

The following is the reports from eu-readelf:

[zhengyong@YZ_X86_64
/rtos/source/frysk/frysk-cvs-anon/build_1023/frysk-core/frysk/util]$ eu-readelf
-n fcore.1269

Note segment of 504 bytes at offset 0x318:
  Owner          Data size  Type
  CORE                 136  PRPSINFO
    state: T (84),  zombie: 49,  nice: 48
    flags: 00800000  uid: 0  gid: 0
    pid: 1269  ppid: 2698  pgrp: 1269  sid: 2698
    fname: loop
     args: ./loop

  CORE                 336  PRSTATUS
    SIGINFO:  signo: 0, code = 0, errno = 0
    signal: 0, pending: 00000000, holding: 00000000
    pid: 1269, ppid = 2698, pgrp = 1269, sid = 2698
     utime:      0.000000s,  stime:      0.000000s
    cutime:      0.000000s, cstime:      0.000000s
    rax: 0000003f80b449b0  rbx: 0000003f80819be0
    rcx: 0000000000400480  rdx: 00007fff8dbb44d8
    rsi: 00007fff8dbb44c8  rdi: 0000000000000001
    rbp: 00007fff8dbb43e0  rsp: 0000003f80b449b0
    r8:  0000003f80b43260  r9:  0000000000000000
    r10: 0000003f8091c690  r11: 0000003f80819be0
    r12: 0000000000000000  r13: 00007fff8dbb44c0
    r14: 0000000000000000  r15: 0000000000000000
    rip: 000000000040046c  eflags: 00000246
    original rax: ffffffffffffffff
    cs: 0033  ds: 0000  es: 0000  ss: 002b
    fs: 0000  fs_base: 00002aaaaaad21e0  gs: 0000  gs_base: 0000000000000000
Comment 2 Yong Zheng 2006-10-25 09:16:45 UTC
For the byte array in gcj, if its value is the following:

byte[] name = {'l','o','o','p',0};

then we use it to new one string like:

String str = new String(name);

then the str.length() will return 5 but 4 is expected! So we should remove the
zero  in the tail of byte array!