OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [testsuite/] [gdb.gdbtk/] [srcwin3.test] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#   Copyright (C) 1999, 2001 Red Hat, Inc.
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file was written by Martin Hunt (hunt@cygnus.com)
21
 
22
###########################################################
23
# same as srcwin.test, except test debugging executables  #
24
# build without "-g"                                      #
25
###########################################################
26
 
27
# Read in the standard defs file
28
 
29
if {![gdbtk_read_defs]} {
30
  break
31
}
32
 
33
global objdir srcdir
34
 
35
#####                 #####
36
#                         #
37
#  SECTION 1: Mode Tests  #
38
#                         #
39
#####                 #####
40
 
41
# Load the test executable
42
set program [file join $objdir list]
43
if {[catch {gdbtk_test_file $program} t]} {
44
  # This isn't a test case, since if this fails, we're hosed.
45
  gdbtk_test_error "loading \"$program\": $t"
46
}
47
 
48
set srcwin [ManagedWin::open SrcWin]
49
set stw [$srcwin test_get twin]
50
set twin [$stw test_get twin]
51
set statbar [$srcwin test_get _statbar]
52
 
53
# get things started
54
gdb_cmd "break main"
55
gdbtk_test_run
56
 
57
# Test: srcwin3-1.1
58
# Desc: Check for something in source window
59
gdbtk_test srcwin3-1.1 "source window has contents" {
60
  set r 0
61
  set source(main) [$twin get 1.0 end]
62
  if {$source(main) == ""} {set r -1}
63
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
64
  set r
65
} {0}
66
 
67
# Test: srcwin3-1.2
68
# Desc: source->assembly mode change
69
gdbtk_test srcwin3-1.2 "source->assembly mode change" {
70
  set r 0
71
  $srcwin mode "" ASSEMBLY
72
  set twin [$stw test_get twin]
73
  if {$source(main) != [$twin get 1.0 end]} {set r -1}
74
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
75
  set r
76
} {0}
77
 
78
# Test: srcwin3-1.3
79
# Desc: assembly->mixed mode change
80
gdbtk_test srcwin3-1.3 "assembly->mixed mode change" {
81
  set r 0
82
  $srcwin mode "" MIXED
83
  set twin [$stw test_get twin]
84
  if {$source(main) != [$twin get 1.0 end]} {set r -1}
85
  if {[$statbar.mode get] != "MIXED"} {set r -2}
86
  set r
87
} {0}
88
 
89
# Test: srcwin3-1.4
90
# Desc: mixed->src+asm mode change
91
gdbtk_test srcwin3-1.4 "mixed->src+asm mode change" {
92
  set r 0
93
  # mode change may fail if fallover to ASSEMBLY fails
94
  if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 }
95
  set twin [$stw test_get twin]
96
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
97
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
98
  set r
99
} {0}
100
 
101
# Test: srcwin3-1.5
102
# Desc: src+asm->source mode change
103
gdbtk_test srcwin3-1.5 "src+asm->source mode change" {
104
  set r 0
105
  $srcwin mode "" SOURCE
106
  set twin [$stw test_get twin]
107
  if {[$stw test_get bwin] != ""} {set r -2}
108
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
109
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -3}
110
  set r
111
} {0}
112
 
113
# Test: srcwin3-1.6
114
# Desc: source->mixed mode change
115
gdbtk_test srcwin3-1.6 "source->mixed mode change" {
116
  set r 0
117
  $srcwin mode "" MIXED
118
  set twin [$stw test_get twin]
119
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
120
  if {[$statbar.mode get] != "MIXED"} {set r -2}
121
  set r
122
} {0}
123
 
124
# Test: srcwin3-1.7
125
# Desc: mixed->source mode change
126
gdbtk_test srcwin3-1.7 "mixed->source mode change" {
127
  set r 0
128
  $srcwin mode "" SOURCE
129
  set twin [$stw test_get twin]
130
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
131
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
132
  set r
133
} {0}
134
 
135
# Test: srcwin3-1.8
136
# Desc: source->src+asm mode change
137
gdbtk_test srcwin3-1.8 "source->src+asm mode change" {
138
  set r 0
139
  # mode change may fail if fallover to ASSEMBLY fails
140
  if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 }
141
  set twin [$stw test_get twin]
142
  set bwin [$stw test_get bwin]
143
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
144
  if {$bwin != ""} {set r -2}
145
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -3}
146
  set r
147
} {0}
148
 
149
# Test: srcwin3-1.9
150
# Desc: src+asm->assembly mode change
151
gdbtk_test srcwin3-1.9 "src+asm->assembly mode change" {
152
  set r 0
153
  $srcwin mode "" ASSEMBLY
154
  set twin [$stw test_get twin]
155
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
156
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
157
  set r
158
} {0}
159
 
160
# Test: srcwin3-1.10
161
# Desc: assembly->src+asm mode change
162
gdbtk_test srcwin3-1.10 "assembly->src+asm mode change" {
163
  set r 0
164
  # mode change may fail if fallover to ASSEMBLY fails
165
  if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 }
166
  set twin [$stw test_get twin]
167
  set bwin [$stw test_get bwin]
168
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
169
  if {$bwin != ""} {set r -2}
170
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -3}
171
  set r
172
} {0}
173
 
174
# Test: srcwin3-1.11
175
# Desc: src+asm->mixed mode change
176
gdbtk_test srcwin3-1.11 "src+asm->mixed mode change" {
177
  set r 0
178
  $srcwin mode "" MIXED
179
  set twin [$stw test_get twin]
180
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
181
  if {[$statbar.mode get] != "MIXED"} {set r -2}
182
  set r
183
} {0}
184
 
185
# Test: srcwin3-1.12
186
# Desc: mixed->assembly mode change
187
gdbtk_test srcwin3-1.12 "mixed->assembly mode change" {
188
  set r 0
189
  $srcwin mode "" ASSEMBLY
190
  set twin [$stw test_get twin]
191
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
192
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
193
  set r
194
} {0}
195
 
196
# Test: srcwin3-1.13
197
# Desc: assembly->source mode change
198
gdbtk_test srcwin3-1.13 "assembly->source mode change" {
199
  set r 0
200
  $srcwin mode "" SOURCE
201
  set twin [$stw test_get twin]
202
  if {[$twin get 1.0 end] != $source(main)} {set r -1}
203
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
204
  set r
205
} {0}
206
 
207
 
208
#####                       #####
209
#                               #
210
#  SECTION 2: Basic Operations  #
211
#                               #
212
#####                       #####
213
 
214
# Test: srcwin3-2.2
215
# Desc: check contents of function combobox
216
# There won't be any because we have no debug info
217
gdbtk_test srcwin3-2.2 "check contents of function combobox" {
218
  set names [$statbar.func listget 0 end]
219
  llength $names
220
} {0}
221
 
222
# Test: srcwin3-2.3
223
# Desc: goto filename - this won't work, but should leave things as they were
224
gdbtk_test srcwin3-2.3 "goto filename" {
225
  set func [$srcwin test_get _name 1]
226
  $func "" list1.c
227
  set twin [$stw test_get twin]
228
  string compare $source(main) [$twin get 1.0 end]
229
} {0}
230
 
231
# Test: srcwin3-2.6
232
# Desc: goto function
233
gdbtk_test srcwin3-2.6 "goto function bar" {
234
  $srcwin goto_func "" bar
235
  set r 0
236
  set twin [$stw test_get twin]
237
  set source(bar) [$twin get 1.0 end]
238
 
239
  if {$source(bar) == $source(main)} {set r -1000}
240
 
241
  # now get a dump of all tags and check that only one line is
242
  # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG.
243
 
244
  # We know that list1.c should have BROWSE_TAG set at index 5.2
245
  # for function "bar".  If list1.c is changed or the layout of the source
246
  # window is changed, this must be updated.
247
  if {![catch {set z [$twin dump -tag 1.0 end]}]} {
248
    foreach {k v i} $z {
249
      if {$k == "tagon"} {
250
        if {$v == "BROWSE_TAG"} {
251
          incr r
252
        }
253
        if {$v == "STACK_TAG"} { incr r 10}
254
        if {$v == "PC_TAG"} { incr r 100}
255
      }
256
    }
257
  } else {
258
    set r -1
259
  }
260
 
261
  if {$r == 1} {
262
    # things are OK so far, so just verify the function name is displayed
263
    # in the combobox entry field.
264
    set names [$statbar.func get]
265
    if {[string compare $names "bar"]} {set r -2}
266
  }
267
  set r
268
} {1}
269
 
270
# Test: srcwin3-2.7
271
# Desc: goto function "oof". This tests that the correct line is highlighted
272
# with BROWSE_TAG and no other lines are highlighted. It also checks that
273
# the combobox has the correct function name in it.
274
 
275
gdbtk_test srcwin3-2.7 "goto function oof" {
276
  $srcwin goto_func "" oof
277
  set r 0
278
 
279
  set twin [$stw test_get twin]
280
  set source(oof) [$twin get 1.0 end]
281
 
282
  if {$source(bar) == $source(oof)} {set r -1000}
283
  if {$source(oof) == $source(main)} {set r -2000}
284
 
285
  # now get a dump of all tags and check that only one line is
286
  # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG.
287
 
288
  if {![catch {set z [$twin dump -tag 1.0 end]}]} {
289
    foreach {k v i} $z {
290
      if {$k == "tagon"} {
291
        if {$v == "BROWSE_TAG"} {
292
          incr r
293
        }
294
        if {$v == "STACK_TAG"} {incr r 10}
295
        if {$v == "PC_TAG"} {incr r 100}
296
      }
297
    }
298
  } else {
299
    set r -1
300
  }
301
 
302
  if {$r == 1} {
303
    # things are OK so far, so just verify the function name is displayed
304
    # in the combobox entry field.
305
    set names [$statbar.func get]
306
    if {[string compare $names "oof"]} {set r -2}
307
  }
308
  set r
309
} {1}
310
 
311
# Test: srcwin3-2.8
312
# Desc: This test issues a nexti command while browsing oof.
313
# It should jump back to main
314
gdbtk_test srcwin3-2.8 "nexti while browsing" {
315
  gdb_immediate "nexti" 1
316
  set r 0
317
  set name [$statbar.name get]
318
  set func [$statbar.func get]
319
 
320
  # check contents of function combobox
321
  if {$func != "main"} {set r -2}
322
  if {$name != ""} {set r -1}
323
 
324
  # check that correct file is displayed
325
  set twin [$stw test_get twin]
326
  set a [$twin get 1.0 end]
327
  if {[string compare $source(main) $a]} {set r -3}
328
 
329
  # check for PC_TAG
330
  if {$r == 0} {
331
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
332
      foreach {k v i} $z {
333
        if {$k == "tagon"} {
334
          if {$v == "PC_TAG"} {
335
            incr r
336
          }
337
          if {$v == "STACK_TAG"} {incr r 10}
338
          if {$v == "BROWSE_TAG"} {incr r 100}
339
        }
340
      }
341
    } else {
342
      set r -4
343
    }
344
  }
345
  set r
346
} {1}
347
 
348
# Test: srcwin3-2.11
349
# Desc: This test issues a break and a continue
350
gdbtk_test srcwin3-2.11 "set BP and continue" {
351
  gdb_immediate "break oof" 1
352
  gdb_immediate "continue" 1
353
  set r 0
354
  set name [$statbar.name get]
355
  set func [$statbar.func get]
356
 
357
  # check contents of name and function comboboxes
358
  if {$name != ""} {set r -1}
359
  if {$func != "oof"} {set r -2}
360
 
361
  # check that the correct file is displayed
362
  # we must clear the breakpoint first so it doesn't mess up the
363
  # comparison...
364
  gdb_immediate "clear oof" 1
365
  set twin [$stw test_get twin]
366
  set a [$twin get 1.0 end]
367
  if {[string compare $source(oof) $a]} {set r -3}
368
 
369
  # check for PC_TAG
370
  if {$r == 0} {
371
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
372
      foreach {k v i} $z {
373
        if {$k == "tagon"} {
374
          if {$v == "PC_TAG"} {
375
            incr r
376
          }
377
          if {$v == "STACK_TAG"} {incr r 10}
378
          if {$v == "BROWSE_TAG"} {incr r 100}
379
        }
380
      }
381
    } else {
382
      set r -4
383
    }
384
  }
385
  set r
386
} {1}
387
 
388
#####                       #####
389
#                               #
390
#  SECTION 3: Stack Operations  #
391
#                               #
392
#####                       #####
393
 
394
# Test: srcwin3-3.1
395
# Desc: This tests "stack up"
396
gdbtk_test srcwin3-3.1 "stack up (1)" {
397
  $srcwin stack up
398
  set r 0
399
  set name [$statbar.name get]
400
  set func [$statbar.func get]
401
 
402
  # check contents of name and function comboboxes
403
  if {$name != ""} {set r -1}
404
  if {$func != "long_line"} {set r -2}
405
 
406
  # check that the correct file is displayed
407
  set twin [$stw test_get twin]
408
  set source(long_line) [$twin get 1.0 end]
409
  if {![string compare $source(long_line) $source(oof)]} {set r -3}
410
 
411
  # check for PC_TAG and STACK_TAG on correct lines
412
  if {$r == 0} {
413
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
414
      foreach {k v i} $z {
415
        if {$k == "tagon"} {
416
          if {$v == "PC_TAG"} {incr r 5}
417
          if {$v == "STACK_TAG"} {incr r}
418
          if {$v == "BROWSE_TAG"} {incr r 100}
419
        }
420
      }
421
    } else {
422
      set r -4
423
    }
424
  }
425
  set r
426
} {1}
427
 
428
# Test: srcwin3-3.2
429
# Desc: Another "stack up"  test
430
gdbtk_test srcwin3-3.2 "stack up (2)" {
431
  $srcwin stack up
432
  set r 0
433
  set name [$statbar.name get]
434
  set func [$statbar.func get]
435
 
436
  # check contents of name and function comboboxes
437
  if {$name != ""} {set r -1}
438
  if {$func != "bar"} {set r -2}
439
 
440
  # check that the correct file is displayed
441
  set twin [$stw test_get twin]
442
  set a [$twin get 1.0 end]
443
  if {[string compare $source(bar) $a]} {set r -3}
444
 
445
  # check for PC_TAG and STACK_TAG on correct lines
446
  if {$r == 0} {
447
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
448
      foreach {k v i} $z {
449
        if {$k == "tagon"} {
450
          if {$v == "PC_TAG"} {
451
            set r -100
452
          }
453
          if {$v == "STACK_TAG"} {
454
            incr r
455
          }
456
          if {$v == "BROWSE_TAG"} {incr r 100}
457
        }
458
      }
459
    } else {
460
      set r -4
461
    }
462
  }
463
  set r
464
} {1}
465
 
466
# Test: srcwin3-3.3
467
# Desc: Another "stack up"  test
468
gdbtk_test srcwin3-3.3 "stack up (3)" {
469
  $srcwin stack up
470
  set r 0
471
  set name [$statbar.name get]
472
  set func [$statbar.func get]
473
 
474
  # check contents of name and function comboboxes
475
  if {$name != ""} {set r -1}
476
  if {$func != "foo"} {set r -2}
477
 
478
  # check that the correct file is displayed
479
  set twin [$stw test_get twin]
480
  set source(foo) [$twin get 1.0 end]
481
  if {![string compare $source(foo) $source(bar)]} {set r -3}
482
 
483
  # check for PC_TAG and STACK_TAG on correct lines
484
  if {$r == 0} {
485
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
486
      foreach {k v i} $z {
487
        if {$k == "tagon"} {
488
          if {$v == "STACK_TAG"} {
489
            incr r
490
          }
491
          if {$v == "PC_TAG"} {incr r 10}
492
          if {$v == "BROWSE_TAG"} {incr r 100}
493
        }
494
      }
495
    } else {
496
      set r -4
497
    }
498
  }
499
  set r
500
} {1}
501
 
502
# Test: srcwin3-3.4
503
# Desc: Another "stack up"  test
504
gdbtk_test srcwin3-3.4 "stack up (4)" {
505
  $srcwin stack up
506
  set r 0
507
  set name [$statbar.name get]
508
  set func [$statbar.func get]
509
 
510
  # check contents of name and function comboboxes
511
  if {$name != ""} {set r -1}
512
  if {$func != "main"} {set r -2}
513
 
514
  # check that the correct file is displayed
515
  set twin [$stw test_get twin]
516
  set a [$twin get 1.0 end]
517
  if {[string compare $source(main) $a]} {set r -3}
518
 
519
  # check for STACK_TAG
520
  if {$r == 0} {
521
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
522
      foreach {k v i} $z {
523
        if {$k == "tagon"} {
524
          if {$v == "STACK_TAG"} {
525
            incr r
526
          }
527
          if {$v == "PC_TAG"} {incr r 10}
528
          if {$v == "BROWSE_TAG"} {incr r 100}
529
        }
530
      }
531
    } else {
532
      set r -4
533
    }
534
  }
535
  set r
536
} {1}
537
 
538
# Disabled for now because there are different correct results.
539
# Test should be rewritten to include those.
540
# Test: srcwin3-3.5
541
# Desc: "stack up" when we are at the top
542
#gdbtk_test srcwin3-3.5 "stack up when at the top" {
543
#  $srcwin stack up
544
#  set r 0
545
#  set name [$statbar.name get]
546
#  set func [$statbar.func get]
547
 
548
  # check contents of name and function comboboxes
549
#  if {$name != ""} {set r -1}
550
#  if {$func != "main"} {set r -2}
551
 
552
  # check that the correct file is displayed
553
#  set twin [$stw test_get twin]
554
#  set a [$twin get 1.0 end]
555
#  if {[string compare $source(main) $a]} {set r -3}
556
 
557
  # check for STACK_TAG
558
#  if {$r == 0} {
559
#    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
560
#      foreach {k v i} $z {
561
#       if {$k == "tagon"} {
562
#         if {$v == "STACK_TAG"} {
563
#           incr r
564
#         }
565
#         if {$v == "PC_TAG"} {incr r 10}
566
#         if {$v == "BROWSE_TAG"} {incr r 100}
567
#       }
568
#      }
569
#    } else {
570
#      set r -4
571
#    }
572
#  }
573
#  set r
574
#} {1}
575
 
576
# Test: srcwin3-3.6
577
# Desc: "stack down"  test
578
gdbtk_test srcwin3-3.6 "stack down" {
579
  $srcwin stack down
580
  set r 0
581
  set name [$statbar.name get]
582
  set func [$statbar.func get]
583
 
584
  # check contents of name and function comboboxes
585
  if {$name != ""} {set r -1}
586
  if {$func != "foo"} {set r -2}
587
 
588
  # check that the correct file is displayed
589
  set twin [$stw test_get twin]
590
  set a [$twin get 1.0 end]
591
  if {[string compare $source(foo) $a]} {set r -3}
592
 
593
  # check for PC_TAG and STACK_TAG on correct lines
594
  if {$r == 0} {
595
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
596
      foreach {k v i} $z {
597
        if {$k == "tagon"} {
598
          if {$v == "STACK_TAG"} {
599
            incr r
600
          }
601
          if {$v == "PC_TAG"} {incr r 10}
602
          if {$v == "BROWSE_TAG"} {incr r 100}
603
        }
604
      }
605
    } else {
606
      set r -4
607
    }
608
  }
609
  set r
610
} {1}
611
 
612
# Test: srcwin3-3.7
613
# Desc: "stack bottom"  test
614
gdbtk_test srcwin3-3.7 "stack bottom" {
615
  $srcwin stack bottom
616
  set r 0
617
  set name [$statbar.name get]
618
  set func [$statbar.func get]
619
 
620
  # check contents of name and function comboboxes
621
  if {$name != ""} {set r -1}
622
  if {$func != "oof"} {set r -2}
623
 
624
  # check that the correct file is displayed
625
  set twin [$stw test_get twin]
626
  set a [$twin get 1.0 end]
627
  if {[string compare $source(oof) $a]} {set r -3}
628
 
629
  # check for PC_TAG on correct line
630
  if {$r == 0} {
631
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
632
      foreach {k v i} $z {
633
        if {$k == "tagon"} {
634
          if {$v == "PC_TAG"} {
635
            incr r
636
          }
637
          if {$v == "STACK_TAG"} {incr r 10}
638
          if {$v == "BROWSE_TAG"} {incr r 100}
639
        }
640
      }
641
    } else {
642
      set r -4
643
    }
644
  }
645
  set r
646
} {1}
647
 
648
# Test: srcwin3-3.8
649
# Desc: "stack down" when at bottom
650
gdbtk_test srcwin3-3.8 "stack down when at bottom" {
651
  $srcwin stack down
652
  set r 0
653
  set name [$statbar.name get]
654
  set func [$statbar.func get]
655
 
656
  # check contents of name and function comboboxes
657
  if {$name != ""} {set r -1}
658
  if {$func != "oof"} {set r -2}
659
 
660
  # check that the correct file is displayed
661
  set twin [$stw test_get twin]
662
  set a [$twin get 1.0 end]
663
  if {[string compare $source(oof) $a]} {set r -3}
664
 
665
  # check for PC_TAG on correct line
666
  if {$r == 0} {
667
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
668
      foreach {k v i} $z {
669
        if {$k == "tagon"} {
670
          if {$v == "PC_TAG"} {
671
            incr r
672
          }
673
          if {$v == "STACK_TAG"} {incr r 10}
674
          if {$v == "BROWSE_TAG"} {incr r 100}
675
        }
676
      }
677
    } else {
678
      set r -4
679
    }
680
  }
681
  set r
682
} {1}
683
 
684
# 4.1 bp, multiple, balloon, etc
685
 
686
# Test: srcwin3-4.1
687
# Desc: Set BP in another file. Tests bp and cache functions
688
gdbtk_test srcwin3-4.1 "set BP in another file" {
689
  gdb_immediate "break foo" 1
690
  $srcwin goto_func "" foo
691
  set r 0
692
  set name [$statbar.name get]
693
  set func [$statbar.func get]
694
 
695
  # check contents of name and function comboboxes
696
  if {$name != ""} {set r -1}
697
  if {$func != "foo"} {set r -2}
698
 
699
  set twin [$stw test_get twin]
700
 
701
  # check for BROWSE_TAG and BP image
702
  if {$r == 0} {
703
    if {![catch {set z [$twin dump 1.0 end]}]} {
704
      foreach {k v i} $z {
705
        if {$k == "tagon"} {
706
          if {$v == "BROWSE_TAG"} {
707
            incr r
708
          }
709
          if {$v == "STACK_TAG"} {incr r 10}
710
          if {$v == "PC_TAG"} {incr r 100}
711
        } elseif {$k == "image"} {
712
          incr r
713
        }
714
      }
715
    } else {
716
      set r -4
717
    }
718
  }
719
 
720
  if {$r == 2} {
721
    # clear BP and compare with previous contents. This should succeed,
722
    gdb_immediate "clear foo" 1
723
    set a [$twin get 1.0 end]
724
    if {[string compare $source(foo) $a]} {set r -3}
725
  }
726
 
727
  set r
728
} {2}
729
 
730
# Test: srcwin3-4.2
731
# Desc: Test temporary BP
732
gdbtk_test srcwin3-4.2 "temporary BP" {
733
  set r 0
734
  if {[catch {gdb_immediate "tbreak foo" 1} msg]} {
735
    set r -500
736
  }
737
  set name [$statbar.name get]
738
  set func [$statbar.func get]
739
 
740
  # check contents of name and function comboboxes
741
  if {$name != ""} {set r -1}
742
  if {$func != "foo"} {set r -2}
743
 
744
  set twin [$stw test_get twin]
745
 
746
  # check for BROWSE_TAG and BP image on correct line
747
  if {$r == 0} {
748
    if {![catch {set z [$twin dump 1.0 end]}]} {
749
      foreach {k v i} $z {
750
        if {$k == "tagon"} {
751
          if {$v == "BROWSE_TAG"} {
752
            incr r
753
          }
754
          if {$v == "STACK_TAG"} {incr r 10}
755
          if {$v == "PC_TAG"} {incr r 100}
756
        } elseif {$k == "image"} {
757
          incr r
758
        }
759
      }
760
    } else {
761
      set r -4
762
    }
763
  }
764
 
765
  gdb_immediate "continue" 1
766
 
767
  # now check for PC_TAG and no image
768
  if {$r == 2} {
769
    if {![catch {set z [$twin dump 1.0 end]}]} {
770
      foreach {k v i} $z {
771
        if {$k == "tagon"} {
772
          if {$v == "PC_TAG"} {
773
            incr r
774
          }
775
          if {$v == "STACK_TAG"} {incr r 10}
776
          if {$v == "BROWSE_TAG"} {incr r 100}
777
        } elseif {$k == "image"} {
778
          set r -200
779
        }
780
      }
781
    } else {
782
      set r -4
783
    }
784
  }
785
 
786
  set r
787
} {3}
788
 
789
gdbtk_test_done

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.