source: rtems/c/src/librdbg/src/awk.svc @ b8c9883

4.104.114.84.95
Last change on this file since b8c9883 was 981b99f, checked in by Joel Sherrill <joel.sherrill@…>, on 08/10/99 at 16:41:44

Patch from Eric Valette <valette@…> and Emmanuel Raguet
<raguet@…>:

  • the dec21140 driver code has been hardened (various bug fixed) Emmanuel,
  • bug in the mcp750 init code have been fixed (interrupt stack/initial stack initialization), BSS correctly cleared (Eric V)
  • remote debugging over TCP/IP is nearly complete (berakpoints, backtrace, variables,...) (Eric V),
  • exception handling code has also been improved in order to fully support RDBG requirements (Eric V),
  • Property mode set to 100644
File size: 1.6 KB
Line 
1#########################################################################
2#
3#  Component:   RDBG
4#  Module:      awk.svc
5#
6#  Synopsis:    AWK script which transforms the server skeleton produced
7#               by rpcgen(1) into something suitable for RDB servers.
8#
9#########################################################################
10#
11# $Id$
12#
13BEGIN {
14    headerstarted = 0
15    withinproc = 0
16    brack = 0
17}
18
19$1 ~ /^\/\*HEADER_START\*\/$/ {
20    headerstarted = 1
21    printf("#include <rpc/types.h>\n");
22    printf("#include <rpc/rpc.h>\n");
23    printf("#include <stdio.h>\n");
24    printf("#include <stdlib.h>\n");
25    printf("#include <string.h>\n");
26    printf("#include <bsp.h>\n");
27    printf("#include <rdbg/servrpc.h>\n");
28    printf("#include <rdbg/%s>\n", THEPROG);
29    printf("#define fprintf(a,b) printf(b)\n");
30    printf("#define msgout(a) printf(a)\n")
31    printf("#define _msgout(a) fprintf(stderr,a)\n");
32}
33
34$1 ~ /^\/\*HEADER_END\*\/$/ {
35    headerstarted = 0
36}
37
38{
39    if (headerstarted == 1) {
40        print $0
41    } else if ($1 ~ /.*_2.*/) {
42        withinproc = 1
43        printf("void\n");
44        print $0
45    } else if (withinproc == 1) {
46        if ($1 == "switch") {
47            print "\tDPRINTF ((\"remotedeb_2: %s (%d)\\n\", "
48            print "\t\t(unsigned) rqstp->rq_proc < "
49            print "\t\t(unsigned) (sizeof names / sizeof names[0]) ?"
50            print "\t\tnames [rqstp->rq_proc] : \"???\", "
51            print "\t\t(int) rqstp->rq_proc));\n"
52        }
53        for (i = 1; i <= NF; i++) {
54            if ($i == "{") {
55                brack++;
56            } else if ($i == "}") {
57                brack--;
58                if (brack == 0) {
59                    withinproc = 0;
60                }
61            }
62        }
63        if ($1 != "_rpcsvcdirty" ) {
64            print $0
65        }
66    }
67}
Note: See TracBrowser for help on using the repository browser.