stacktrace.cc (8852:c744483edfcf) stacktrace.cc (9069:873634453ae0)
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;

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

69 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
70 panic("thread info not compiled into kernel\n");
71 name_off = vp.readGtoH<int32_t>(addr);
72 }
73
74 Addr
75 ProcessInfo::task(Addr ksp) const
76 {
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;

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

69 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
70 panic("thread info not compiled into kernel\n");
71 name_off = vp.readGtoH<int32_t>(addr);
72 }
73
74 Addr
75 ProcessInfo::task(Addr ksp) const
76 {
77 return 0;
77 Addr base = ksp & ~0x1fff;
78 if (base == ULL(0xffffffffc0000000))
79 return 0;
80
81 Addr tsk;
82
83 FSTranslatingPortProxy &vp = tc->getVirtProxy();
84 tsk = vp.readGtoH<Addr>(base + task_off);
85
86 return tsk;
78 }
79
80 int
81 ProcessInfo::pid(Addr ksp) const
82 {
87 }
88
89 int
90 ProcessInfo::pid(Addr ksp) const
91 {
83 return -1;
92 Addr task = this->task(ksp);
93 if (!task)
94 return -1;
95
96 uint16_t pd;
97
98 FSTranslatingPortProxy &vp = tc->getVirtProxy();
99 pd = vp.readGtoH<uint16_t>(task + pid_off);
100
101 return pd;
84 }
85
86 string
87 ProcessInfo::name(Addr ksp) const
88 {
102 }
103
104 string
105 ProcessInfo::name(Addr ksp) const
106 {
89 return "Implement me";
107 Addr task = this->task(ksp);
108 if (!task)
109 return "unknown";
110
111 char comm[256];
112 CopyStringOut(tc, comm, task + name_off, sizeof(comm));
113 if (!comm[0])
114 return "startup";
115
116 return comm;
90 }
91
92 StackTrace::StackTrace()
93 : tc(0), stack(64)
94 {
95 }
96
97 StackTrace::StackTrace(ThreadContext *_tc, StaticInstPtr inst)

--- 53 unchanged lines hidden ---
117 }
118
119 StackTrace::StackTrace()
120 : tc(0), stack(64)
121 {
122 }
123
124 StackTrace::StackTrace(ThreadContext *_tc, StaticInstPtr inst)

--- 53 unchanged lines hidden ---