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;

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

106string
107ProcessInfo::name(Addr ksp) const
108{
109 Addr task = this->task(ksp);
110 if (!task)
111 return "console";
112
113 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;

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

106string
107ProcessInfo::name(Addr ksp) const
108{
109 Addr task = this->task(ksp);
110 if (!task)
111 return "console";
112
113 char comm[256];
114 CopyStringOut(tc, comm, task + name_off, sizeof(comm));
114 tc->getVirtProxy().readString(comm, task + name_off, sizeof(comm));
115 if (!comm[0])
116 return "startup";
117
118 return comm;
119}
120
121StackTrace::StackTrace()
122 : tc(0), stack(64)

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

306bool
307StackTrace::decodePrologue(Addr sp, Addr callpc, Addr func, int &size,
308 Addr &ra)
309{
310 size = 0;
311 ra = 0;
312
313 for (Addr pc = func; pc < callpc; pc += sizeof(MachInst)) {
115 if (!comm[0])
116 return "startup";
117
118 return comm;
119}
120
121StackTrace::StackTrace()
122 : tc(0), stack(64)

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

306bool
307StackTrace::decodePrologue(Addr sp, Addr callpc, Addr func, int &size,
308 Addr &ra)
309{
310 size = 0;
311 ra = 0;
312
313 for (Addr pc = func; pc < callpc; pc += sizeof(MachInst)) {
314 MachInst inst;
315 CopyOut(tc, (uint8_t *)&inst, pc, sizeof(MachInst));
314 MachInst inst = tc->getVirtProxy().read<MachInst>(pc);
316
317 int reg, disp;
318 if (decodeStack(inst, disp)) {
319 if (size) {
320 // panic("decoding frame size again");
321 return true;
322 }
323 size += disp;
324 } else if (decodeSave(inst, reg, disp)) {
325 if (!ra && reg == ReturnAddressReg) {
315
316 int reg, disp;
317 if (decodeStack(inst, disp)) {
318 if (size) {
319 // panic("decoding frame size again");
320 return true;
321 }
322 size += disp;
323 } else if (decodeSave(inst, reg, disp)) {
324 if (!ra && reg == ReturnAddressReg) {
326 CopyOut(tc, (uint8_t *)&ra, sp + disp, sizeof(Addr));
325 ra = tc->getVirtProxy().read<Addr>(sp + disp);
327 if (!ra) {
328 // panic("no return address value pc=%#x\n", pc);
329 return false;
330 }
331 }
332 }
333 }
334

--- 30 unchanged lines hidden ---
326 if (!ra) {
327 // panic("no return address value pc=%#x\n", pc);
328 return false;
329 }
330 }
331 }
332 }
333

--- 30 unchanged lines hidden ---