tracechild.cc (8229:78bf55f23338) tracechild.cc (11321:02e930db812d)
1/*
2 * Copyright (c) 2006-2007 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;

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

225 bool bcc = (cond & 0x7) &&
226 (sig == 0x1 || sig == 0x2 || sig == 0x3 || sig == 0x5 || sig == 0x6);
227
228 if (annul) {
229 if (bcc) {
230 target1 = npc;
231 target2 = npc + 4;
232 return 2;
1/*
2 * Copyright (c) 2006-2007 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;

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

225 bool bcc = (cond & 0x7) &&
226 (sig == 0x1 || sig == 0x2 || sig == 0x3 || sig == 0x5 || sig == 0x6);
227
228 if (annul) {
229 if (bcc) {
230 target1 = npc;
231 target2 = npc + 4;
232 return 2;
233 } else if(ba) {
233 } else if (ba) {
234 //This branches immediately to the effective address of the branch
235 //which we'll have to calculate.
236 uint64_t disp = 0;
237 int64_t extender = 0;
238 //Figure out how big the displacement field is, and grab the bits
239 if (sig == 0x1 || sig == 0x5) {
240 disp = inst & ((1 << 19) - 1);
241 extender = 1 << 18;
242 } else {
243 disp = inst & ((1 << 22) - 1);
244 extender = 1 << 21;
245 }
246 //This does sign extension, believe it or not.
247 disp = (disp ^ extender) - extender;
248 //Multiply the displacement by 4. I'm assuming the compiler is
249 //smart enough to turn this into a shift.
250 disp *= 4;
251 target1 = pc + disp;
234 //This branches immediately to the effective address of the branch
235 //which we'll have to calculate.
236 uint64_t disp = 0;
237 int64_t extender = 0;
238 //Figure out how big the displacement field is, and grab the bits
239 if (sig == 0x1 || sig == 0x5) {
240 disp = inst & ((1 << 19) - 1);
241 extender = 1 << 18;
242 } else {
243 disp = inst & ((1 << 22) - 1);
244 extender = 1 << 21;
245 }
246 //This does sign extension, believe it or not.
247 disp = (disp ^ extender) - extender;
248 //Multiply the displacement by 4. I'm assuming the compiler is
249 //smart enough to turn this into a shift.
250 disp *= 4;
251 target1 = pc + disp;
252 } else if(bn)
252 } else if (bn)
253 target1 = npc + 4;
254 else
255 target1 = npc;
256 return 1;
257 } else {
258 target1 = npc;
259 return 1;
260 }

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

411 uint64_t cargv;
412 do {
413 cargv = ptrace(PTRACE_PEEKDATA, pid, sp, 0);
414 if (v8) cargv = cargv >> 32;
415 sprintf(obuf, "0x%016llx: argv[%d] = 0x%016llx\n",
416 sp, argCount++, cargv);
417 os << obuf;
418 sp += v8 ? 4 : 8;
253 target1 = npc + 4;
254 else
255 target1 = npc;
256 return 1;
257 } else {
258 target1 = npc;
259 return 1;
260 }

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

411 uint64_t cargv;
412 do {
413 cargv = ptrace(PTRACE_PEEKDATA, pid, sp, 0);
414 if (v8) cargv = cargv >> 32;
415 sprintf(obuf, "0x%016llx: argv[%d] = 0x%016llx\n",
416 sp, argCount++, cargv);
417 os << obuf;
418 sp += v8 ? 4 : 8;
419 } while(cargv);
419 } while (cargv);
420 //Output the envp pointers
421 int envCount = 0;
422 uint64_t cenvp;
423 do {
424 cenvp = ptrace(PTRACE_PEEKDATA, pid, sp, 0);
425 if (v8) cenvp = cenvp >> 32;
426 sprintf(obuf, "0x%016llx: envp[%d] = 0x%016llx\n",
427 sp, envCount++, cenvp);

--- 46 unchanged lines hidden ---
420 //Output the envp pointers
421 int envCount = 0;
422 uint64_t cenvp;
423 do {
424 cenvp = ptrace(PTRACE_PEEKDATA, pid, sp, 0);
425 if (v8) cenvp = cenvp >> 32;
426 sprintf(obuf, "0x%016llx: envp[%d] = 0x%016llx\n",
427 sp, envCount++, cenvp);

--- 46 unchanged lines hidden ---