File: evax_get_foreign.c

package info (click to toggle)
gnat-gdb 5.3.gnat.0.0.20030225-8
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 75,144 kB
  • ctags: 101,348
  • sloc: ansic: 873,511; exp: 46,950; sh: 16,123; makefile: 11,757; yacc: 6,092; asm: 5,027; cpp: 4,044; perl: 2,624; lex: 877; sed: 550; lisp: 394; awk: 170; pascal: 57; java: 7; fortran: 5
file content (65 lines) | stat: -rw-r--r-- 1,967 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <string.h>
#include <descrip.h>
#include <starlet.h>
#include <ssdef.h>
#include <stdio.h>
#include <unistd.h>
#include <secdef.h>
#include <va_rangedef.h>

static char _align (page) gdbstub_command_line[1024];

unsigned long int
gdbstub_get_foreign
  (struct dsc$descriptor_s *resultant_string,
   struct dsc$descriptor_s *prompt_string,
   unsigned short int *resultant_length,
   unsigned long int *flags)
{
  struct dsc$descriptor_s gdbstub_psc;
  char pscbuff[16];
  int mypid = getpid ();
  long status;
  va_range gdbstub_command_line_inadr =
    {&gdbstub_command_line [0], &gdbstub_command_line [1023]};
  va_range gdbstub_command_line_retadr;

  sprintf (pscbuff, "gdbstub%x", mypid);
  gdbstub_psc.dsc$w_length = strlen (pscbuff);
  gdbstub_psc.dsc$b_dtype = DSC$K_DTYPE_T;
  gdbstub_psc.dsc$b_class = DSC$K_CLASS_S;
  gdbstub_psc.dsc$a_pointer = pscbuff;

  status = sys$crmpsc
    (&gdbstub_command_line_inadr,  /* inadr */
     &gdbstub_command_line_retadr, /* retadr */
     0,                            /* acmode */
     SEC$M_GBL | SEC$M_EXPREG | SEC$M_PAGFIL,     /* flags */
     &gdbstub_psc,                 /* gsdnam */
     0,                            /* ident */
     0,                            /* relpag */
     0,                            /* chan */
     1,                            /* pagcnt */
     0,                            /* vbn */
     0,                            /* prot */
     0                             /* pfc */
     );

#if 0
  printf ("gdbstub_get_foreign retadr: %x - %x\n",
	  gdbstub_command_line_retadr.va_range$ps_start_va,
	  gdbstub_command_line_retadr.va_range$ps_end_va);
#endif

  strcpy (resultant_string->dsc$a_pointer,
	  (char *) gdbstub_command_line_retadr.va_range$ps_start_va);
  *resultant_length
    = strlen ((char *) gdbstub_command_line_retadr.va_range$ps_start_va);

#if 0
  printf ("evax_get_foreign: '%s'\n", resultant_string->dsc$a_pointer);
#endif

  return SS$_NORMAL;
}