Exemple #1
0
void
pc386_gdb_init (void)
{
  printf ("GDB Initialisation\n");

  i386_stub_glue_init (BSP_UART_COM2);

  /*
   * Init GDB stub itself
   */
  set_debug_traps();

  /*
   * Init GDB break in capability, has to be called after set_debug_traps
   */
  i386_stub_glue_init_breakin();

  /*
   * Put breakpoint in and stop and wait for GDB.
   */
  breakpoint();
}
Exemple #2
0
 /* Init GDB glue  */
void init_remote_gdb( void )
{
  if(BSPConsolePort != BSP_UART_COM2)
    {
      /*
       * If com2 is not used as console use it for
       * debugging
       */

      i386_stub_glue_init(BSP_UART_COM2);
      printf( "Remote GDB using COM2...\n" );

    }
  else
    {
      /* Otherwise use com1 */
      i386_stub_glue_init(BSP_UART_COM1);
      printf( "Remote GDB using COM1...\n" );
    }

  printf( "Remote GDB: setting traps...\n" );
  /* Init GDB stub itself */
  set_debug_traps();

  printf( "Remote GDB: waiting remote connection....\n" );

  /*
   * Init GDB break in capability,
   * has to be called after
   * set_debug_traps
   */
  i386_stub_glue_init_breakin();

  /* Put breakpoint in */
  /* breakpoint();     */
  /* BREAKPOINT();     */
}
Exemple #3
0
void pc386_parse_gdb_arguments(void)
{
  static const char *opt;

  /*
   * Check the command line to see if com1-com4 are disabled.
   */
  opt = bsp_cmdline_arg("--gdb=");
  if ( opt ) {
    const char                *option;
    const char                *comma;
    size_t                     length;
    size_t                     index;
    rtems_device_minor_number  minor;
    uint32_t                   baudrate = 115200;
    bool                       halt = false;
    console_tbl               *port;

    /*
     * Fine the length, there can be more command line visible.
     */
    length = 0;
    while ((opt[length] != ' ') && (opt[length] != '\0')) {
      ++length;
      if (length > NAME_MAX) {
        printk("invalid option (--gdb): too long\n");
        return;
      }
    }

    /*
     * Only match up to a comma or NULL
     */
    index = 0;
    while ((opt[index] != '=') && (index < length)) {
      ++index;
    }

    if (opt[index] != '=') {
      printk("invalid option (--gdb): no equals\n");
      return;
    }

    ++index;
    option = &opt[index];

    while ((opt[index] != ',') && (index < length)) {
      ++index;
    }

    if (opt[index] == ',')
      comma = &opt[index];
    else
      comma = NULL;

    length = &opt[index] - option;

    port = console_find_console_entry( option, length, &minor );

    if ( port == NULL ) {
      printk("invalid option (--gdb): port not found\n");
      return;
    }

    if (comma) {
      option = comma + 1;
      baudrate = strtoul(option, 0, 10);
      switch (baudrate) {
        case 115200:
        case 57600:
        case 38400:
        case 19200:
        case 9600:
        case 4800:
          port->pDeviceParams = (void*) baudrate;
          BSPBaseBaud = baudrate; /* REMOVE ME */
          break;
        default:
          printk("invalid option (--gdb): bad baudrate\n");
          return;
      }
    }

    /*
     * Provide a probe that fails so the device is not part of termios. All
     * functions are polling.
     */
    port->deviceProbe = gdb_port_probe;
    port->pDeviceFns = &ns16550_fns_polled;

    opt = bsp_cmdline_arg("--gdb-remote-debug");
    if ( opt ) {
      remote_debug = 1;
    }

    opt = bsp_cmdline_arg("--gdb-break");
    if ( opt ) {
      halt = true;
    }

    printk("GDB stub: enable %s%s%s\n",
           port->sDeviceName,
           remote_debug ? ", remote-debug" : "",
           halt ? ", halting" : "");

    i386_stub_glue_init(minor);
    set_debug_traps();
    i386_stub_glue_init_breakin();

    if ( halt ) {
      printk("GDB stub: waiting for remote connection..\n");
      breakpoint();
    }
  }
}