Revision 5b50e790 gdbstub.c

b/gdbstub.c
40 40
#include "cpu.h"
41 41
#include "qemu/sockets.h"
42 42
#include "sysemu/kvm.h"
43
#include "qemu/bitops.h"
44 43

  
45 44
static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
46 45
                                         uint8_t *buf, int len, bool is_write)
......
316 315

  
317 316
static GDBState *gdbserver_state;
318 317

  
319
/* This is an ugly hack to cope with both new and old gdb.
320
   If gdb sends qXfer:features:read then assume we're talking to a newish
321
   gdb that understands target descriptions.  */
322
static int gdb_has_xml;
318
bool gdb_has_xml;
323 319

  
324 320
#ifdef CONFIG_USER_ONLY
325 321
/* XXX: This is not thread safe.  Do we care?  */
......
489 485
    return put_packet_binary(s, buf, strlen(buf));
490 486
}
491 487

  
492
#if defined(TARGET_I386)
493

  
494
#include "target-i386/gdbstub.c"
495

  
496
#elif defined (TARGET_PPC)
488
#if defined(TARGET_PPC)
497 489

  
498 490
#if defined (TARGET_PPC64)
499 491
#define GDB_CORE_XML "power64-core.xml"
......
501 493
#define GDB_CORE_XML "power-core.xml"
502 494
#endif
503 495

  
504
#include "target-ppc/gdbstub.c"
505

  
506
#elif defined (TARGET_SPARC)
507

  
508
#include "target-sparc/gdbstub.c"
509

  
510 496
#elif defined (TARGET_ARM)
511 497

  
512 498
#define GDB_CORE_XML "arm-core.xml"
513 499

  
514
#include "target-arm/gdbstub.c"
515

  
516 500
#elif defined (TARGET_M68K)
517 501

  
518 502
#define GDB_CORE_XML "cf-core.xml"
519 503

  
520
#include "target-m68k/gdbstub.c"
521

  
522
#elif defined (TARGET_MIPS)
523

  
524
#include "target-mips/gdbstub.c"
525

  
526
#elif defined(TARGET_OPENRISC)
527

  
528
#include "target-openrisc/gdbstub.c"
529

  
530
#elif defined (TARGET_SH4)
531

  
532
#include "target-sh4/gdbstub.c"
533

  
534
#elif defined (TARGET_MICROBLAZE)
535

  
536
#include "target-microblaze/gdbstub.c"
537

  
538
#elif defined (TARGET_CRIS)
539

  
540
#include "target-cris/gdbstub.c"
541

  
542
#elif defined (TARGET_ALPHA)
543

  
544
#include "target-alpha/gdbstub.c"
545

  
546
#elif defined (TARGET_S390X)
547

  
548
#include "target-s390x/gdbstub.c"
549

  
550
#elif defined (TARGET_LM32)
551

  
552
#include "target-lm32/gdbstub.c"
553

  
554
#elif defined(TARGET_XTENSA)
555

  
556
#include "target-xtensa/gdbstub.c"
557

  
558
#else
559

  
560
static int cpu_gdb_read_register(CPUArchState *env, uint8_t *mem_buf, int n)
561
{
562
    return 0;
563
}
564

  
565
static int cpu_gdb_write_register(CPUArchState *env, uint8_t *mem_buf, int n)
566
{
567
    return 0;
568
}
569

  
570 504
#endif
571 505

  
572 506
#ifdef GDB_CORE_XML
......
642 576
    GDBRegisterState *r;
643 577

  
644 578
    if (reg < cc->gdb_num_core_regs) {
645
        return cpu_gdb_read_register(env, mem_buf, reg);
579
        return cc->gdb_read_register(cpu, mem_buf, reg);
646 580
    }
647 581

  
648 582
    for (r = cpu->gdb_regs; r; r = r->next) {
......
660 594
    GDBRegisterState *r;
661 595

  
662 596
    if (reg < cc->gdb_num_core_regs) {
663
        return cpu_gdb_write_register(env, mem_buf, reg);
597
        return cc->gdb_write_register(cpu, mem_buf, reg);
664 598
    }
665 599

  
666 600
    for (r = cpu->gdb_regs; r; r = r->next) {
......
1212 1146
            const char *xml;
1213 1147
            target_ulong total_len;
1214 1148

  
1215
            gdb_has_xml = 1;
1149
            gdb_has_xml = true;
1216 1150
            p += 19;
1217 1151
            xml = get_feature_xml(p, &p);
1218 1152
            if (!xml) {
......
1621 1555
    s->c_cpu = first_cpu;
1622 1556
    s->g_cpu = first_cpu;
1623 1557
    s->fd = fd;
1624
    gdb_has_xml = 0;
1558
    gdb_has_xml = false;
1625 1559

  
1626 1560
    gdbserver_state = s;
1627 1561

  
......
1707 1641
    switch (event) {
1708 1642
    case CHR_EVENT_OPENED:
1709 1643
        vm_stop(RUN_STATE_PAUSED);
1710
        gdb_has_xml = 0;
1644
        gdb_has_xml = false;
1711 1645
        break;
1712 1646
    default:
1713 1647
        break;

Also available in: Unified diff