stacktrace.cc (2680:246e7104f744) stacktrace.cc (2684:71f3cabf891f)
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 33 unchanged lines hidden (view full) ---

42using namespace std;
43using namespace AlphaISA;
44
45ProcessInfo::ProcessInfo(ThreadContext *_tc)
46 : tc(_tc)
47{
48 Addr addr = 0;
49
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 33 unchanged lines hidden (view full) ---

42using namespace std;
43using namespace AlphaISA;
44
45ProcessInfo::ProcessInfo(ThreadContext *_tc)
46 : tc(_tc)
47{
48 Addr addr = 0;
49
50 VirtualPort *vp;
51
52 vp = tc->getVirtPort();
53
50 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_size", addr))
51 panic("thread info not compiled into kernel\n");
54 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_size", addr))
55 panic("thread info not compiled into kernel\n");
52 thread_info_size = gtoh(tc->getVirtPort()->read<int32_t>(addr));
56 thread_info_size = vp->readGtoH<int32_t>(addr);
53
54 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_size", addr))
55 panic("thread info not compiled into kernel\n");
57
58 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_size", addr))
59 panic("thread info not compiled into kernel\n");
56 task_struct_size = gtoh(tc->getVirtPort()->read<int32_t>(addr));
60 task_struct_size = vp->readGtoH<int32_t>(addr);
57
58 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_task", addr))
59 panic("thread info not compiled into kernel\n");
61
62 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_task", addr))
63 panic("thread info not compiled into kernel\n");
60 task_off = gtoh(tc->getVirtPort()->read<int32_t>(addr));
64 task_off = vp->readGtoH<int32_t>(addr);
61
62 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_pid", addr))
63 panic("thread info not compiled into kernel\n");
65
66 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_pid", addr))
67 panic("thread info not compiled into kernel\n");
64 pid_off = gtoh(tc->getVirtPort()->read<int32_t>(addr));
68 pid_off = vp->readGtoH<int32_t>(addr);
65
66 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
67 panic("thread info not compiled into kernel\n");
69
70 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
71 panic("thread info not compiled into kernel\n");
68 name_off = gtoh(tc->getVirtPort()->read<int32_t>(addr));
72 name_off = vp->readGtoH<int32_t>(addr);
73
74 tc->delVirtPort(vp);
69}
70
71Addr
72ProcessInfo::task(Addr ksp) const
73{
74 Addr base = ksp & ~0x3fff;
75 if (base == ULL(0xfffffc0000000000))
76 return 0;
77
75}
76
77Addr
78ProcessInfo::task(Addr ksp) const
79{
80 Addr base = ksp & ~0x3fff;
81 if (base == ULL(0xfffffc0000000000))
82 return 0;
83
78 return gtoh(tc->getVirtPort()->read<Addr>(base + task_off));
84 Addr tsk;
85
86 VirtualPort *vp;
87
88 vp = tc->getVirtPort();
89 tsk = vp->readGtoH<Addr>(base + task_off);
90 tc->delVirtPort(vp);
91
92 return tsk;
79}
80
81int
82ProcessInfo::pid(Addr ksp) const
83{
84 Addr task = this->task(ksp);
85 if (!task)
86 return -1;
87
93}
94
95int
96ProcessInfo::pid(Addr ksp) const
97{
98 Addr task = this->task(ksp);
99 if (!task)
100 return -1;
101
88 return gtoh(tc->getVirtPort()->read<uint16_t>(task + pid_off));
102 uint16_t pd;
103
104 VirtualPort *vp;
105
106 vp = tc->getVirtPort();
107 pd = vp->readGtoH<uint16_t>(task + pid_off);
108 tc->delVirtPort(vp);
109
110 return pd;
89}
90
91string
92ProcessInfo::name(Addr ksp) const
93{
94 Addr task = this->task(ksp);
95 if (!task)
96 return "console";

--- 250 unchanged lines hidden ---
111}
112
113string
114ProcessInfo::name(Addr ksp) const
115{
116 Addr task = this->task(ksp);
117 if (!task)
118 return "console";

--- 250 unchanged lines hidden ---