~ubuntu-branches/ubuntu/trusty/kcov/trusty

« back to all changes in this revision

Viewing changes to src/arch/ppc32.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Tautschnig
  • Date: 2010-12-17 10:03:23 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101217100323-03njos8sfhhuax0y
Tags: 4-1
* New upstream release
  - Fixes FTBFS on non-x86 architectures (closes: #603135).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdint.h>
 
2
#include <elf.h>
 
3
 
 
4
#include <kc_ptrace_arch.h>
 
5
 
 
6
enum
 
7
{
 
8
        PPC32_R_PC = 33, /* From asm/ptrace.h */
 
9
};
 
10
 
 
11
static unsigned long ppc32_get_pc(struct kc *kc, void *regs_cooked)
 
12
{
 
13
        uint32_t *regs = (uint32_t *)regs_cooked;
 
14
 
 
15
        return (unsigned long)regs[PPC32_R_PC];
 
16
}
 
17
 
 
18
static unsigned long ppc32_setup_breakpoint(struct kc *kc,
 
19
                unsigned long addr, unsigned long old_data)
 
20
{
 
21
        return 0x7fe00008; /* trap */
 
22
}
 
23
 
 
24
static void ppc32_adjust_pc_after_breakpoint(struct kc *kc,
 
25
                void *regs_cooked)
 
26
{
 
27
        uint32_t *regs = (uint32_t *)regs_cooked;
 
28
 
 
29
        regs[PPC32_R_PC] -= 4;
 
30
}
 
31
 
 
32
static struct kc_ptrace_arch ppc32_arch =
 
33
{
 
34
        .e_machines = (int[]){EM_PPC, EM_NONE},
 
35
        .get_pc = ppc32_get_pc,
 
36
        .setup_breakpoint = ppc32_setup_breakpoint,
 
37
        .adjust_pc_after_breakpoint = ppc32_adjust_pc_after_breakpoint,
 
38
};