source: rtems/c/src/lib/libbsp/i386/ts_386ex/tools/debug_ada/serial_debug.adb @ 1d4048b2

4.104.114.84.95
Last change on this file since 1d4048b2 was 1d4048b2, checked in by Joel Sherrill <joel.sherrill@…>, on 08/11/99 at 23:45:57

Patch from Tony R. Ambardar <tonya@…>:

I'm attaching a big patch for the ts_386ex BSP which adds and includes
the following:

1) Conversion to ELF format + minor code cleanups + documentation.

2) An Ada95 binding to FreeBSD sockets, based on Samuel Tardieu's

adasockets-0.1.3 package. This includes some sample applications.

3) Some Ada and C interfaces to add serial-port debugging to

programs. Comes with examples, too; the Ada one shows how
transparent adding the support can be. Note that Rosimildo sent me
the original C code.

The network stuff is not BSP specific, and could be added to your Ada
code collection. The debugging stuff is specific to the i386. Right
now, everything sits in my "tools" directory.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1with Ada.Text_IO;  use Ada.Text_IO;
2with System.Machine_Code;  use System.Machine_Code;
3
4package body Serial_Debug is
5
6   ----------------
7   -- Breakpoint --
8   ----------------
9
10   procedure Breakpoint is
11   begin
12      Asm ("int $3",
13           No_Output_Operands,
14           No_Input_Operands,
15           Volatile => True);
16   end Breakpoint;
17
18
19   -- This type is from uart.h
20   -- Equivalent to an int, with (COM1, COM2) => (0, 1)
21
22   type BSP_Uart is (COM1, COM2);
23   pragma Convention (C, BSP_Uart);
24
25
26   -- The serial port currently used for console I/O
27
28   BSP_Console_Port: BSP_Uart;
29   pragma Import (C, BSP_Console_Port, "BSPConsolePort");
30
31
32   -- C utility routines to set up serial-port debugging
33
34   procedure I386_Stub_Glue_Init (Debug_Port: in BSP_Uart);
35   pragma Import (C, I386_Stub_Glue_Init, "i386_stub_glue_init");
36
37   procedure Set_Debug_Traps;
38   pragma Import (C, Set_Debug_Traps, "set_debug_traps");
39
40   procedure I386_Stub_Glue_Init_Breakin;
41   pragma Import (C, I386_Stub_Glue_Init_Breakin,
42                  "i386_stub_glue_init_breakin");
43
44begin
45
46   if BSP_Console_Port /= COM2
47   then
48      I386_Stub_Glue_Init (COM2);
49
50      Put_Line ("Remote GDB using COM2...");
51   else
52      I386_Stub_Glue_Init (COM1);
53
54      Put_Line ("Remote GDB using COM1...");
55   end if;
56
57   Put_Line ("Remote GDB setting traps...");
58
59   Set_Debug_Traps;
60
61   Put_Line ("Remote GDB waiting for connection...");
62
63   I386_Stub_Glue_Init_Breakin;
64
65end Serial_Debug;
66
Note: See TracBrowser for help on using the repository browser.