~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/misc/kgdbts.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
285
285
static int check_and_rewind_pc(char *put_str, char *arg)
286
286
{
287
287
        unsigned long addr = lookup_addr(arg);
 
288
        unsigned long ip;
288
289
        int offset = 0;
289
290
 
290
291
        kgdb_hex2mem(&put_str[1], (char *)kgdbts_gdb_regs,
291
292
                 NUMREGBYTES);
292
293
        gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs);
293
 
        v2printk("Stopped at IP: %lx\n", instruction_pointer(&kgdbts_regs));
294
 
#ifdef CONFIG_X86
295
 
        /* On x86 a breakpoint stop requires it to be decremented */
296
 
        if (addr + 1 == kgdbts_regs.ip)
297
 
                offset = -1;
298
 
#elif defined(CONFIG_SUPERH)
299
 
        /* On SUPERH a breakpoint stop requires it to be decremented */
300
 
        if (addr + 2 == kgdbts_regs.pc)
301
 
                offset = -2;
 
294
        ip = instruction_pointer(&kgdbts_regs);
 
295
        v2printk("Stopped at IP: %lx\n", ip);
 
296
#ifdef GDB_ADJUSTS_BREAK_OFFSET
 
297
        /* On some arches, a breakpoint stop requires it to be decremented */
 
298
        if (addr + BREAK_INSTR_SIZE == ip)
 
299
                offset = -BREAK_INSTR_SIZE;
302
300
#endif
303
 
        if (strcmp(arg, "silent") &&
304
 
                instruction_pointer(&kgdbts_regs) + offset != addr) {
 
301
        if (strcmp(arg, "silent") && ip + offset != addr) {
305
302
                eprintk("kgdbts: BP mismatch %lx expected %lx\n",
306
 
                           instruction_pointer(&kgdbts_regs) + offset, addr);
 
303
                           ip + offset, addr);
307
304
                return 1;
308
305
        }
309
 
#ifdef CONFIG_X86
310
 
        /* On x86 adjust the instruction pointer if needed */
311
 
        kgdbts_regs.ip += offset;
312
 
#elif defined(CONFIG_SUPERH)
313
 
        kgdbts_regs.pc += offset;
 
306
        /* Readjust the instruction pointer if needed */
 
307
        ip += offset;
 
308
#ifdef GDB_ADJUSTS_BREAK_OFFSET
 
309
        instruction_pointer_set(&kgdbts_regs, ip);
314
310
#endif
315
311
        return 0;
316
312
}
645
641
 
646
642
        while (*chk_str != '\0' && *put_str != '\0') {
647
643
                /* If someone does a * to match the rest of the string, allow
648
 
                 * it, or stop if the recieved string is complete.
 
644
                 * it, or stop if the received string is complete.
649
645
                 */
650
646
                if (*put_str == '#' || *chk_str == '*')
651
647
                        return 0;
988
984
 
989
985
static int kgdbts_option_setup(char *opt)
990
986
{
991
 
        if (strlen(opt) > MAX_CONFIG_LEN) {
 
987
        if (strlen(opt) >= MAX_CONFIG_LEN) {
992
988
                printk(KERN_ERR "kgdbts: config string too long\n");
993
989
                return -ENOSPC;
994
990
        }