File: parser.y

package info (click to toggle)
bochs 1.4pre2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,656 kB
  • ctags: 10,322
  • sloc: cpp: 66,880; ansic: 19,674; sh: 2,951; makefile: 2,183; asm: 2,110; yacc: 723; lex: 171; csh: 147; perl: 35
file content (787 lines) | stat: -rw-r--r-- 18,389 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
/////////////////////////////////////////////////////////////////////////
// $Id: parser.y,v 1.6 2001/11/28 18:35:21 instinc Exp $
/////////////////////////////////////////////////////////////////////////

%{
#include <stdio.h>
#include <stdlib.h>
#include "debug.h"
// %left '-' '+'
// %left '*' '/'
// %right
// %nonassoc UMINUS
%}


%union {
  char    *sval;
  Bit32u   uval;
  Bit64u   ulval;
  bx_num_range   uval_range;
  }

%token <sval> BX_TOKEN_CONTINUE
%token <sval> BX_TOKEN_STEPN
%token <sval> BX_TOKEN_NEXT_STEP
%token <sval> BX_TOKEN_SET
%token <sval> BX_TOKEN_DEBUGGER
%token <sval> BX_TOKEN_VBREAKPOINT
%token <sval> BX_TOKEN_LBREAKPOINT
%token <sval> BX_TOKEN_PBREAKPOINT
%token <sval> BX_TOKEN_DEL_BREAKPOINT
%token <sval> BX_TOKEN_INFO
%token <sval> BX_TOKEN_QUIT
%token <sval> BX_TOKEN_PROGRAM
%token <sval> BX_TOKEN_REGISTERS
%token <sval> BX_TOKEN_FPU
%token <sval> BX_TOKEN_ALL
%token <sval> BX_TOKEN_IDT
%token <sval> BX_TOKEN_GDT
%token <sval> BX_TOKEN_LDT
%token <sval> BX_TOKEN_TSS
%token <sval> BX_TOKEN_DIRTY
%token <sval> BX_TOKEN_LINUX
%token <sval> BX_TOKEN_CONTROL_REGS
%token <sval> BX_TOKEN_EXAMINE
%token <sval> BX_TOKEN_XFORMAT
%token <sval> BX_TOKEN_SETPMEM
%token <sval> BX_TOKEN_SYMBOLNAME
%token <sval> BX_TOKEN_QUERY
%token <sval> BX_TOKEN_PENDING
%token <sval> BX_TOKEN_TAKE
%token <sval> BX_TOKEN_DMA
%token <sval> BX_TOKEN_IRQ
%token <sval> BX_TOKEN_DUMP_CPU
%token <sval> BX_TOKEN_SET_CPU
%token <sval> BX_TOKEN_DIS
%token <sval> BX_TOKEN_ON
%token <sval> BX_TOKEN_OFF
%token <sval> BX_TOKEN_DISASSEMBLE
%token <sval> BX_TOKEN_INSTRUMENT
%token <sval> BX_TOKEN_START
%token <sval> BX_TOKEN_STOP
%token <sval> BX_TOKEN_RESET
%token <sval> BX_TOKEN_PRINT
%token <sval> BX_TOKEN_LOADER
%token <sval> BX_TOKEN_STRING
%token <sval> BX_TOKEN_DOIT
%token <sval> BX_TOKEN_CRC
%token <sval> BX_TOKEN_TRACEON
%token <sval> BX_TOKEN_TRACEOFF
%token <sval> BX_TOKEN_PTIME
%token <sval> BX_TOKEN_TIMEBP_ABSOLUTE
%token <sval> BX_TOKEN_TIMEBP
%token <sval> BX_TOKEN_RECORD
%token <sval> BX_TOKEN_PLAYBACK
%token <sval> BX_TOKEN_MODEBP
%token <sval> BX_TOKEN_PRINT_STACK
%token <sval> BX_TOKEN_WATCH
%token <sval> BX_TOKEN_UNWATCH
%token <sval> BX_TOKEN_READ
%token <sval> BX_TOKEN_WRITE
%token <sval> BX_TOKEN_SHOW
%token <sval> BX_TOKEN_SYMBOL
%token <sval> BX_TOKEN_GLOBAL
%token <sval> BX_TOKEN_WHERE
%token <sval> BX_TOKEN_PRINT_STRING
%token <sval> BX_TOKEN_DIFF_MEMORY
%token <sval> BX_TOKEN_SYNC_MEMORY
%token <sval> BX_TOKEN_SYNC_CPU
%token <sval> BX_TOKEN_FAST_FORWARD
%token <sval> BX_TOKEN_PHY_2_LOG
%token <uval> BX_TOKEN_NUMERIC
%token <ulval> BX_TOKEN_LONG_NUMERIC
%token <sval> BX_TOKEN_INFO_ADDRESS
%token <sval> BX_TOKEN_NE2000
%token <sval> BX_TOKEN_PAGE
%token <sval> BX_TOKEN_CS
%token <sval> BX_TOKEN_ES
%token <sval> BX_TOKEN_SS
%token <sval> BX_TOKEN_DS
%token <sval> BX_TOKEN_FS
%token <sval> BX_TOKEN_GS
%token <sval> BX_TOKEN_ALWAYS_CHECK
%token <sval> BX_TOKEN_MATHS
%token <sval> BX_TOKEN_ADD
%token <sval> BX_TOKEN_SUB
%token <sval> BX_TOKEN_MUL
%token <sval> BX_TOKEN_DIV
%token <sval> BX_TOKEN_V2L
%token <sval> BX_TOKEN_TRACEREGON
%token <sval> BX_TOKEN_TRACEREGOFF
%type <uval> segment_register
%type <uval> optional_numeric
%type <uval_range> numeric_range optional_numeric_range

%start command

%%
command:
      continue_command
    | stepN_command
    | set_command
    | breakpoint_command
    | info_command
    | dump_cpu_command
    | delete_command
    | quit_command
    | examine_command
    | setpmem_command
    | query_command
    | take_command
    | set_cpu_command
    | disassemble_command
    | instrument_command
    | loader_command
    | doit_command
    | crc_command
    | maths_command
    | trace_on_command
    | trace_off_command
    | ptime_command
    | timebp_command
    | record_command
    | playback_command
    | modebp_command
    | print_stack_command
    | watch_point_command
    | show_command
    | symbol_command
    | where_command
    | print_string_command
    | cosim_commands
    | v2l_command
    | trace_reg_on_command
    | trace_reg_off_command
    | 
    | '\n'
      {
      }
    ;

cosim_commands:
      BX_TOKEN_DIFF_MEMORY '\n'
        {
		bx_dbg_diff_memory();
		free($1);
	}
    | BX_TOKEN_SYNC_MEMORY BX_TOKEN_ON '\n'
        {
		bx_dbg_sync_memory(1);
		free($1); free($2);
	}
    | BX_TOKEN_SYNC_MEMORY BX_TOKEN_OFF '\n'
        {
		bx_dbg_sync_memory(0);
		free($1); free($2);
	}
    | BX_TOKEN_SYNC_CPU BX_TOKEN_ON '\n'
        {
		bx_dbg_sync_cpu(1);
		free($1); free($2);
	}
    | BX_TOKEN_SYNC_CPU BX_TOKEN_OFF '\n'
        {
		bx_dbg_sync_cpu(0);
		free($1); free($2);
	}
    | BX_TOKEN_FAST_FORWARD BX_TOKEN_NUMERIC '\n'
        {
		free($1);
		bx_dbg_fast_forward($2);
	}
    | BX_TOKEN_PHY_2_LOG BX_TOKEN_NUMERIC '\n'
        {
	}
    | BX_TOKEN_INFO_ADDRESS segment_register ':' BX_TOKEN_NUMERIC '\n'
        {
		free($1);
		bx_dbg_info_address($2, $4);
        }
    | BX_TOKEN_ALWAYS_CHECK BX_TOKEN_NUMERIC BX_TOKEN_ON '\n'
        {
        }
    | BX_TOKEN_ALWAYS_CHECK BX_TOKEN_NUMERIC BX_TOKEN_OFF '\n'
        {
        }
    ;

segment_register:
      BX_TOKEN_CS { $$ = 1; }
    | BX_TOKEN_ES { $$ = 0; }
    | BX_TOKEN_SS { $$ = 2; }
    | BX_TOKEN_DS { $$ = 3; }
    | BX_TOKEN_FS { $$ = 4; }
    | BX_TOKEN_GS { $$ = 5; }
    ;

timebp_command:
      BX_TOKEN_TIMEBP BX_TOKEN_LONG_NUMERIC '\n'
        {
        bx_dbg_timebp_command(0, $2);
	free($1);
	}
    | BX_TOKEN_TIMEBP_ABSOLUTE BX_TOKEN_LONG_NUMERIC '\n'
        {
        bx_dbg_timebp_command(1, $2);
	free($1);
	}
    ;

record_command:
	BX_TOKEN_RECORD BX_TOKEN_STRING '\n'
          {
          bx_dbg_record_command($2);
          free($1); free($2);
          }
    ;

playback_command:
	BX_TOKEN_PLAYBACK BX_TOKEN_STRING '\n'
          {
          bx_dbg_playback_command($2);
          free($1); free($2);
          }
    ;

modebp_command:
	BX_TOKEN_MODEBP BX_TOKEN_STRING '\n'
          {
          bx_dbg_modebp_command($2);
          free($1); free($2);
          }
	| BX_TOKEN_MODEBP '\n'
          {
          bx_dbg_modebp_command(0);
          free($1);
          }
    ;

show_command:
	BX_TOKEN_SHOW BX_TOKEN_STRING '\n'
          {
          bx_dbg_show_command($2);
          free($1); free($2);
          }
	| BX_TOKEN_SHOW '\n'
          {
          bx_dbg_show_command(0);
          free($1);
          }
    ;

ptime_command:
      BX_TOKEN_PTIME '\n'
        {
        bx_dbg_ptime_command();
        free($1);
	}
    ;

trace_on_command:
      BX_TOKEN_TRACEON '\n'
        {
        bx_dbg_trace_on_command();
        free($1);
	}
    ;

trace_off_command:
      BX_TOKEN_TRACEOFF '\n'
        {
        bx_dbg_trace_off_command();
        free($1);
	}
    ;

print_stack_command:
	BX_TOKEN_PRINT_STACK '\n'
          {
          bx_dbg_print_stack_command(16);
          free($1);
	  }
    |   BX_TOKEN_PRINT_STACK BX_TOKEN_NUMERIC '\n'
          {
          bx_dbg_print_stack_command($2);
          free($1);
	  }
    ;

watch_point_command:
	BX_TOKEN_WATCH BX_TOKEN_STOP '\n'
          {
          watchpoint_continue = 0;
	  fprintf(stderr, "Will stop on watch points\n");
          free($1); free($2);
          }
    |   BX_TOKEN_WATCH BX_TOKEN_CONTINUE '\n'
          {
          watchpoint_continue = 1;
          fprintf(stderr, "Will not stop on watch points (they will still be logged)\n");
          free($1); free($2);
          }
    |   BX_TOKEN_WATCH '\n'
          {
          bx_dbg_watch(-1, 0);
          free($1);
          }
    |   BX_TOKEN_UNWATCH '\n'
          {
          bx_dbg_unwatch(-1, 0);
          free($1);
          }
    |   BX_TOKEN_WATCH BX_TOKEN_READ BX_TOKEN_NUMERIC '\n'
          {
          bx_dbg_watch(1, $3);
          free($1); free($2);
          }
    |   BX_TOKEN_UNWATCH BX_TOKEN_READ BX_TOKEN_NUMERIC '\n'
          {
          bx_dbg_unwatch(1, $3);
          free($1); free($2);
          }
    |   BX_TOKEN_WATCH BX_TOKEN_WRITE BX_TOKEN_NUMERIC '\n'
          {
          bx_dbg_watch(0, $3);
          free($1); free($2);
          }
    |   BX_TOKEN_UNWATCH BX_TOKEN_WRITE BX_TOKEN_NUMERIC '\n'
          {
          bx_dbg_unwatch(0, $3);
          free($1); free($2);
          }
    ;

symbol_command:
      BX_TOKEN_SYMBOL BX_TOKEN_STRING '\n' 
        {
	bx_dbg_symbol_command($2, 0, 0);
        free($1); free($2);
        }
    | BX_TOKEN_SYMBOL BX_TOKEN_STRING BX_TOKEN_NUMERIC '\n' 
        {
	bx_dbg_symbol_command($2, 0, $3);
        free($1); free($2);
        }
    | BX_TOKEN_SYMBOL BX_TOKEN_GLOBAL BX_TOKEN_STRING BX_TOKEN_NUMERIC '\n' 
        {
	bx_dbg_symbol_command($3, 1, $4);
        free($1); free($2); free($3);
        }
    ;

where_command:
      BX_TOKEN_WHERE '\n'
        {
        bx_dbg_where_command();
        free($1);
        }
    ;

print_string_command:
      BX_TOKEN_PRINT_STRING BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_print_string_command($2);
        free($1);
        }
    ;

continue_command:
      BX_TOKEN_CONTINUE '\n'
        {
        bx_dbg_continue_command();
        free($1);
        }
    ;

stepN_command:
      BX_TOKEN_STEPN '\n'
        {
        bx_dbg_stepN_command(1);
        free($1);
        }
    | BX_TOKEN_STEPN BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_stepN_command($2);
        free($1);
        }
    ;

set_command:
      BX_TOKEN_SET BX_TOKEN_DIS BX_TOKEN_ON '\n'
        {
        bx_dbg_set_command($1, $2, $3);
        free($1); free($2); free($3);
        }
    | BX_TOKEN_SET BX_TOKEN_DIS BX_TOKEN_OFF '\n'
        {
        bx_dbg_set_command($1, $2, $3);
        free($1); free($2); free($3);
        }
    | BX_TOKEN_SET BX_TOKEN_SYMBOLNAME '=' BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_set_symbol_command($2, $4);
        free($1); free($2);
        }
    ;

breakpoint_command:
      BX_TOKEN_VBREAKPOINT '\n'
        {
        bx_dbg_vbreakpoint_command(0, 0, 0);
        free($1);
        }
    | BX_TOKEN_VBREAKPOINT BX_TOKEN_NUMERIC ':' BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_vbreakpoint_command(1, $2, $4);
        free($1);
        }
    | BX_TOKEN_LBREAKPOINT '\n'
        {
        bx_dbg_lbreakpoint_command(0, 0);
        free($1);
        }
    | BX_TOKEN_LBREAKPOINT BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_lbreakpoint_command(1, $2);
        free($1);
        }
    | BX_TOKEN_PBREAKPOINT '\n'
        {
        bx_dbg_pbreakpoint_command(0, 0);
        free($1);
        }
    | BX_TOKEN_PBREAKPOINT BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_pbreakpoint_command(1, $2);
        free($1);
        }
    | BX_TOKEN_PBREAKPOINT '*' BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_pbreakpoint_command(1, $3);
        free($1);
        }
    ;

info_command:
      BX_TOKEN_INFO BX_TOKEN_PBREAKPOINT '\n'
        {
        bx_dbg_info_bpoints_command();
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_PROGRAM '\n'
        {
        bx_dbg_info_program_command();
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_REGISTERS '\n'
        {
        bx_dbg_info_registers_command(BX_INFO_CPU_REGS);
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_FPU '\n'
        {
        bx_dbg_info_registers_command(BX_INFO_FPU_REGS);
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_ALL '\n'
        {
        bx_dbg_info_registers_command(BX_INFO_CPU_REGS | BX_INFO_FPU_REGS);
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_DIRTY '\n'
        {
        bx_dbg_info_dirty_command();
        free($1); free($2);
	}
    | BX_TOKEN_INFO BX_TOKEN_IDT optional_numeric_range '\n'
        {
        bx_dbg_info_idt_command($3);
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_GDT optional_numeric_range '\n'
        {
        bx_dbg_info_gdt_command($3);
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_LDT optional_numeric_range '\n'
        {
        bx_dbg_info_ldt_command($3);
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_TSS optional_numeric_range '\n'
        {
        bx_dbg_info_tss_command($3);
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_LINUX '\n'
        {
        bx_dbg_info_linux_command();
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_CONTROL_REGS '\n'
        {
        bx_dbg_info_control_regs_command();
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_NE2000 '\n'
        {
        bx_dbg_info_ne2k(-1, -1);
        free($1); free($2);
        }
    | BX_TOKEN_INFO BX_TOKEN_NE2000 BX_TOKEN_PAGE BX_TOKEN_NUMERIC '\n'
        {
        free($1); free($2); free($3);
        bx_dbg_info_ne2k($4, -1);
        }
    | BX_TOKEN_INFO BX_TOKEN_NE2000 BX_TOKEN_PAGE BX_TOKEN_NUMERIC BX_TOKEN_REGISTERS BX_TOKEN_NUMERIC '\n'
        {
        free($1); free($2); free($3); free($5);
        bx_dbg_info_ne2k($4, $6);
        }
    ;

optional_numeric :
   /* empty */ { $$ = EMPTY_ARG; }
   | BX_TOKEN_NUMERIC;

optional_numeric_range:
  /* empty */ { $$ = make_num_range (EMPTY_ARG, EMPTY_ARG); }
  | numeric_range;

numeric_range :
  BX_TOKEN_NUMERIC
  {
    $$ = make_num_range ($1, $1);
  }
  | 
  BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC
  {
    $$ = make_num_range ($1, $2);
  }
  | 
  BX_TOKEN_NUMERIC ':' BX_TOKEN_NUMERIC
  {
    $$ = make_num_range ($1, $3);
  };
   

dump_cpu_command:
      BX_TOKEN_DUMP_CPU '\n'
        {
        bx_dbg_dump_cpu_command();
        free($1);
        }
    ;

delete_command:
      BX_TOKEN_DEL_BREAKPOINT BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_del_breakpoint_command($2);
        free($1);
        }
    ;

quit_command:
      BX_TOKEN_QUIT '\n'
        {
	  bx_dbg_quit_command();
	  free($1);
        }
    ;


examine_command:
      BX_TOKEN_EXAMINE BX_TOKEN_XFORMAT BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_examine_command($1, $2,1, $3,1, 0);
#if BX_NUM_SIMULATORS >= 2
        bx_dbg_examine_command($1, $2,1, $3,1, 1);
#endif
        free($1); free($2);
        }
    | BX_TOKEN_EXAMINE BX_TOKEN_XFORMAT '\n'
        {
        bx_dbg_examine_command($1, $2,1, 0,0, 0);
#if BX_NUM_SIMULATORS >= 2
        bx_dbg_examine_command($1, $2,1, 0,0, 1);
#endif
        free($1); free($2);
        }
    | BX_TOKEN_EXAMINE BX_TOKEN_NUMERIC '\n'
        {
        //FIXME HanishKVC This method of hunting thro all the 
        //      simulators may be better than using 2 calls if 
        //      BX_NUM_SIMULATORS greater than or equal to 2 as 
        //      done for other cases of BX_TOKEN_EXAMINE
        int iCurSim; 
        for(iCurSim = 0; iCurSim < BX_NUM_SIMULATORS; iCurSim++)
        {
          bx_dbg_examine_command($1, NULL,0, $2,1, iCurSim);
        }
        free($1);
        }
    | BX_TOKEN_EXAMINE '\n'
        {
        //FIXME HanishKVC This method of hunting thro all the 
        //      simulators may be better than using 2 calls if 
        //      BX_NUM_SIMULATORS greater than or equal to 2 as 
        //      done for other cases of BX_TOKEN_EXAMINE
        int iCurSim; 
        for(iCurSim = 0; iCurSim < BX_NUM_SIMULATORS; iCurSim++)
        {
          bx_dbg_examine_command($1, NULL,0, 0,0, iCurSim);
        }
        free($1);
        }
    ;

setpmem_command:
      BX_TOKEN_SETPMEM BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_setpmem_command($2, $3, $4);
        free($1);
        }
    ;

query_command:
      BX_TOKEN_QUERY BX_TOKEN_PENDING '\n'
        {
        bx_dbg_query_command($2);
        free($1); free($2);
        }
    ;

take_command:
      BX_TOKEN_TAKE BX_TOKEN_DMA '\n'
        {
        bx_dbg_take_command($2, 1);
        free($1); free($2);
        }
    | BX_TOKEN_TAKE BX_TOKEN_DMA BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_take_command($2, $3);
        free($1); free($2);
        }
    | BX_TOKEN_TAKE BX_TOKEN_IRQ '\n'
        {
        bx_dbg_take_command($2, 1);
        free($1); free($2);
        }
    ;

set_cpu_command:
      BX_TOKEN_SET_CPU '\n'
        {
        bx_dbg_set_cpu_command();
        free($1);
        }
    ;

disassemble_command:
      BX_TOKEN_DISASSEMBLE optional_numeric_range '\n'
        {
        bx_dbg_disassemble_command($2);
        free($1);
        }
    ;

instrument_command:
      BX_TOKEN_INSTRUMENT BX_TOKEN_START '\n'
        {
        bx_dbg_instrument_command($2);
        free($1); free($2);
        }
    | BX_TOKEN_INSTRUMENT BX_TOKEN_STOP '\n'
        {
        bx_dbg_instrument_command($2);
        free($1); free($2);
        }
    | BX_TOKEN_INSTRUMENT BX_TOKEN_RESET '\n'
        {
        bx_dbg_instrument_command($2);
        free($1); free($2);
        }
    | BX_TOKEN_INSTRUMENT BX_TOKEN_PRINT '\n'
        {
        bx_dbg_instrument_command($2);
        free($1); free($2);
        }
    ;

loader_command:
      BX_TOKEN_LOADER BX_TOKEN_STRING '\n'
        {
        bx_dbg_loader_command($2);
        free($1); free($2);
        }
    ;

doit_command:
      BX_TOKEN_DOIT BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_doit_command($2);
        free($1);
        }
    ;

crc_command:
      BX_TOKEN_CRC BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_crc_command($2, $3);
        free($1);
        }
    ;

maths_command:
      BX_TOKEN_MATHS BX_TOKEN_ADD BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_maths_command($2, $3, $4);
        free($1); free($2);
        }
    | BX_TOKEN_MATHS BX_TOKEN_SUB BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_maths_command($2, $3, $4);
        free($1); free($2);
        }
    | BX_TOKEN_MATHS BX_TOKEN_MUL BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_maths_command($2, $3, $4);
        free($1); free($2);
        }
    | BX_TOKEN_MATHS BX_TOKEN_DIV BX_TOKEN_NUMERIC BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_maths_command($2, $3, $4);
        free($1); free($2);
        }
    | BX_TOKEN_MATHS BX_TOKEN_STRING '\n'
        {
        bx_dbg_maths_expression_command($2);
        free($1); free($2);
        }

v2l_command:
      BX_TOKEN_V2L segment_register ':' BX_TOKEN_NUMERIC '\n'
        {
        bx_dbg_v2l_command($2, $4);
        free($1);
        }
    ;

trace_reg_on_command:
      BX_TOKEN_TRACEREGON '\n'
        {
	bx_dbg_trace_reg_on_command();
	free($1);
	}
    ;

trace_reg_off_command:
      BX_TOKEN_TRACEREGOFF '\n'
        {
	bx_dbg_trace_reg_off_command();
	free($1);
	}
    ;

%%