stacktrace.cc (13893:0e863b6c441a) stacktrace.cc (14018:9d2153431f44)
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;

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

99std::string
100ProcessInfo::name(Addr ksp) const
101{
102 Addr task = this->task(ksp);
103 if (!task)
104 return "console";
105
106 char comm[256];
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;

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

99std::string
100ProcessInfo::name(Addr ksp) const
101{
102 Addr task = this->task(ksp);
103 if (!task)
104 return "console";
105
106 char comm[256];
107 CopyStringOut(tc, comm, task + name_off, sizeof(comm));
107 tc->getVirtProxy().readString(comm, task + name_off, sizeof(comm));
108 if (!comm[0])
109 return "startup";
110
111 return comm;
112}
113
114StackTrace::StackTrace()
115 : tc(0), stack(64)

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

159bool
160StackTrace::decodePrologue(Addr sp, Addr callpc, Addr func,
161 int &size, Addr &ra)
162{
163 size = 0;
164 ra = 0;
165
166 for (Addr pc = func; pc < callpc; pc += sizeof(MachInst)) {
108 if (!comm[0])
109 return "startup";
110
111 return comm;
112}
113
114StackTrace::StackTrace()
115 : tc(0), stack(64)

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

159bool
160StackTrace::decodePrologue(Addr sp, Addr callpc, Addr func,
161 int &size, Addr &ra)
162{
163 size = 0;
164 ra = 0;
165
166 for (Addr pc = func; pc < callpc; pc += sizeof(MachInst)) {
167 MachInst inst;
168 CopyOut(tc, (uint8_t *)&inst, pc, sizeof(MachInst));
167 MachInst inst = tc->getVirtProxy().read<MachInst>(pc);
169
170 int reg, disp;
171 if (decodeStack(inst, disp)) {
172 if (size) {
173 // panic("decoding frame size again");
174 return true;
175 }
176 size += disp;
177 } else if (decodeSave(inst, reg, disp)) {
178 if (!ra && reg == ReturnAddressReg) {
168
169 int reg, disp;
170 if (decodeStack(inst, disp)) {
171 if (size) {
172 // panic("decoding frame size again");
173 return true;
174 }
175 size += disp;
176 } else if (decodeSave(inst, reg, disp)) {
177 if (!ra && reg == ReturnAddressReg) {
179 CopyOut(tc, (uint8_t *)&ra, sp + disp, sizeof(Addr));
178 ra = tc->getVirtProxy().read<Addr>(sp + disp);
180 if (!ra) {
181 // panic("no return address value pc=%#x\n", pc);
182 return false;
183 }
184 }
185 }
186 }
187

--- 30 unchanged lines hidden ---
179 if (!ra) {
180 // panic("no return address value pc=%#x\n", pc);
181 return false;
182 }
183 }
184 }
185 }
186

--- 30 unchanged lines hidden ---