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

Subversion Repositories or1k

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

Go to most recent revision | 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
# when source files are missing.
25
 
26
# Read in the standard defs file
27
 
28
if {![gdbtk_read_defs]} {
29
  break
30
}
31
 
32
global objdir srcdir
33
 
34
#####                 #####
35
#                         #
36
#  SECTION 1: Mode Tests  #
37
#                         #
38
#####                 #####
39
 
40
# Load the test executable
41
set program [file join $objdir list]
42
if {[catch {gdbtk_test_file $program} t]} {
43
  # This isn't a test case, since if this fails, we're hosed.
44
  gdbtk_test_error "loading \"$program\": $t"
45
}
46
 
47
set srcwin [ManagedWin::open SrcWin]
48
set stw [$srcwin test_get twin]
49
set twin [$stw test_get twin]
50
set statbar [$srcwin test_get _statbar]
51
 
52
# get things started
53
gdb_cmd "break main"
54
gdbtk_test_run
55
 
56
# Test: srcwin2-1.1
57
# Desc: Check for something in source window
58
gdbtk_test srcwin2-1.1 "source window has contents" {
59
  set r 0
60
  set file1(source) [$twin get 1.0 end]
61
  if {$file1(source) == ""} {set r -1}
62
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
63
  set r
64
} {0}
65
 
66
# Test: srcwin2-1.2
67
# Desc: source->assembly mode change
68
gdbtk_test srcwin2-1.2 "source->assembly mode change" {
69
  $srcwin mode "" ASSEMBLY
70
  set twin [$stw test_get twin]
71
  set file1(assembly) [$twin get 1.0 end]
72
  # source == assembly because for there is no source
73
  string compare $file1(source) $file1(assembly)
74
} {0}
75
 
76
# Test: srcwin2-1.3
77
# Desc: assembly->mixed mode change
78
gdbtk_test srcwin2-1.3 "assembly->mixed mode change" {
79
  set r 0
80
  $srcwin mode "" MIXED
81
  set twin [$stw test_get twin]
82
  set file1(mixed) [$twin get 1.0 end]
83
  # mixed != assembly because the lines with source should
84
  # be noted, even if source in unavailable.
85
  if {$file1(mixed) == $file1(assembly)} {set r -1}
86
  if {[$statbar.mode get] != "MIXED"} {set r -2}
87
  set r
88
} {0}
89
 
90
# Test: srcwin2-1.4
91
# Desc: mixed->src+asm mode change
92
gdbtk_test srcwin2-1.4 "mixed->src+asm mode change" {
93
  set r 0
94
  # mode change may fail if fallover to ASSEMBLY fails
95
  if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 }
96
  set twin [$stw test_get twin]
97
  if {[$twin get 1.0 end] != $file1(assembly)} {set r -1}
98
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
99
  set r
100
} {0}
101
 
102
# Test: srcwin2-1.5
103
# Desc: src+asm->source mode change
104
gdbtk_test srcwin2-1.5 "src+asm->source mode change" {
105
  set r 0
106
  $srcwin mode "" SOURCE
107
  set twin [$stw test_get twin]
108
  if {[$stw test_get bwin] != ""} {set r -2}
109
  if {[$twin get 1.0 end] != $file1(assembly)} {set r -1}
110
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -3}
111
  set r
112
} {0}
113
 
114
# Test: srcwin2-1.6
115
# Desc: source->mixed mode change
116
gdbtk_test srcwin2-1.6 "source->mixed mode change" {
117
  set r 0
118
  $srcwin mode "" MIXED
119
  set twin [$stw test_get twin]
120
  if {[$twin get 1.0 end] != $file1(mixed)} {set r -1}
121
  if {[$statbar.mode get] != "MIXED"} {set r -2}
122
  set r
123
} {0}
124
 
125
# Test: srcwin2-1.7
126
# Desc: mixed->source mode change
127
gdbtk_test srcwin2-1.7 "mixed->source mode change" {
128
  set r 0
129
  $srcwin mode "" SOURCE
130
  set twin [$stw test_get twin]
131
  if {[$twin get 1.0 end] != $file1(source)} {set r -1}
132
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
133
  set r
134
} {0}
135
 
136
# Test: srcwin2-1.8
137
# Desc: source->src+asm mode change
138
gdbtk_test srcwin2-1.8 "source->src+asm mode change" {
139
  set r 0
140
  # mode change may fail if fallover to ASSEMBLY fails
141
  if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 }
142
  set twin [$stw test_get twin]
143
  set bwin [$stw test_get bwin]
144
  if {[$twin get 1.0 end] != $file1(assembly)} {set r -1}
145
  if {$bwin != ""} {set r -2}
146
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -3}
147
  set r
148
} {0}
149
 
150
# Test: srcwin2-1.9
151
# Desc: src+asm->assembly mode change
152
gdbtk_test srcwin2-1.9 "src+asm->assembly mode change" {
153
  set r 0
154
  $srcwin mode "" ASSEMBLY
155
  set twin [$stw test_get twin]
156
  if {[$twin get 1.0 end] != $file1(assembly)} {set r -1}
157
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
158
  set r
159
} {0}
160
 
161
# Test: srcwin2-1.10
162
# Desc: assembly->src+asm mode change
163
gdbtk_test srcwin2-1.10 "assembly->src+asm mode change" {
164
  set r 0
165
  # mode change may fail if fallover to ASSEMBLY fails
166
  if {[catch {$srcwin mode "" SRC+ASM}]} { set r -5 }
167
  set twin [$stw test_get twin]
168
  set bwin [$stw test_get bwin]
169
  if {[$twin get 1.0 end] != $file1(assembly)} {set r -1}
170
  if {$bwin != ""} {set r -2}
171
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -3}
172
  set r
173
} {0}
174
 
175
# Test: srcwin2-1.11
176
# Desc: src+asm->mixed mode change
177
gdbtk_test srcwin2-1.11 "src+asm->mixed mode change" {
178
  set r 0
179
  $srcwin mode "" MIXED
180
  set twin [$stw test_get twin]
181
  if {[$twin get 1.0 end] != $file1(mixed)} {set r -1}
182
  if {[$statbar.mode get] != "MIXED"} {set r -2}
183
  set r
184
} {0}
185
 
186
# Test: srcwin2-1.12
187
# Desc: mixed->assembly mode change
188
gdbtk_test srcwin2-1.12 "mixed->assembly mode change" {
189
  set r 0
190
  $srcwin mode "" ASSEMBLY
191
  set twin [$stw test_get twin]
192
  if {[$twin get 1.0 end] != $file1(assembly)} {set r -1}
193
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
194
  set r
195
} {0}
196
 
197
# Test: srcwin2-1.13
198
# Desc: assembly->source mode change
199
gdbtk_test srcwin2-1.13 "assembly->source mode change" {
200
  set r 0
201
  $srcwin mode "" SOURCE
202
  set twin [$stw test_get twin]
203
  if {[$twin get 1.0 end] != $file1(source)} {set r -1}
204
  if {[$statbar.mode get] != "ASSEMBLY"} {set r -2}
205
  set r
206
} {0}
207
 
208
 
209
#####                       #####
210
#                               #
211
#  SECTION 2: Basic Operations  #
212
#                               #
213
#####                       #####
214
 
215
# Test: srcwin2-2.1
216
# Desc: check contents of filename combobox
217
gdbtk_test srcwin2-2.1 "check contents of filename combobox" {
218
  set names [$statbar.name listget 0 end]
219
  set r 0
220
  foreach f {list0.c list1.c list0.h} {
221
    if {[lsearch $names $f] != -1} {
222
      incr r
223
    }
224
  }
225
  set r
226
} {3}
227
 
228
# Test: srcwin2-2.2
229
# Desc: check contents of function combobox
230
gdbtk_test srcwin2-2.2 "check contents of function combobox" {
231
  set names [$statbar.func listget 0 end]
232
  set r 0
233
  foreach f {main foo unused} {
234
    if {[lsearch $names $f] != -1} {
235
      incr r
236
    }
237
  }
238
  set r
239
} {3}
240
 
241
# Test: srcwin2-2.3
242
# Desc: goto filename
243
gdbtk_test srcwin2-2.3 "goto filename" {
244
  set func [$srcwin test_get _name 1]
245
  $func "" list1.c
246
  set twin [$stw test_get twin]
247
  set file2(source) [$twin get 1.0 end]
248
  expr {![string compare $file1(source) $file2(source)]}
249
} {0}
250
 
251
# Test: srcwin2-2.4
252
# Desc: check contents of function combobox
253
gdbtk_test srcwin2-2.4 "check contents of function combobox" {
254
  set names [$statbar.func listget 0 end]
255
  set r 0
256
  foreach f {bar long_line oof unused} {
257
    if {[lsearch $names $f] != -1} {
258
      incr r
259
    }
260
  }
261
  set r
262
} {4}
263
 
264
# Test: srcwin2-2.5
265
# Desc: function combobox entry field should be empty after switching to a new file
266
gdbtk_test srcwin2-2.5 "function combobox entry field should be empty" {
267
  set names [$statbar.func get]
268
  string length $names
269
} {0}
270
 
271
# Test: srcwin2-2.6
272
# Desc: goto function
273
gdbtk_test srcwin2-2.6 "goto function bar" {
274
  $srcwin goto_func "" bar
275
  set r 0
276
 
277
  # now get a dump of all tags and check that only one line is
278
  # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG.
279
 
280
  # We know that list1.c should have BROWSE_TAG set at index 10.2
281
  # for function "bar".  If list1.c is changed or the layout of the source
282
  # window is changed, this must be updated.
283
  if {![catch {set z [$twin dump -tag 1.0 end]}]} {
284
    foreach {k v i} $z {
285
      if {$k == "tagon"} {
286
        if {$v == "BROWSE_TAG"} {
287
          if {$i == "10.2"} {
288
            incr r
289
          } else {
290
            incr r 5
291
          }
292
        }
293
        if {$v == "STACK_TAG"} { incr r 10}
294
        if {$v == "PC_TAG"} { incr r 100}
295
      }
296
    }
297
  } else {
298
    set r -1
299
  }
300
 
301
  if {$r == 1} {
302
    # things are OK so far, so just verify the function name is displayed
303
    # in the combobox entry field.
304
    set names [$statbar.func get]
305
    if {[string compare $names "bar"]} {set r -2}
306
  }
307
  set r
308
} {1}
309
 
310
# Test: srcwin2-2.7
311
# Desc: goto function "oof". This tests that the correct line is highlighted
312
# with BROWSE_TAG and no other lines are highlighted. It also checks that
313
# the combobox has the correct function name in it.  Finally, list1.c
314
# has an extremely long line, line 32, that breaks some functions.  We verify
315
# that the GDBtk has the correct line number.
316
 
317
gdbtk_test srcwin2-2.7 "goto function oof" {
318
  $srcwin goto_func "" oof
319
  set r 0
320
 
321
  # now get a dump of all tags and check that only one line is
322
  # marked BROWSE_TAG and no lines are STACK_TAG or PC_TAG.
323
 
324
  # We know that list1.c should have BROWSE_TAG set at index 38.2
325
  # for function "oof".  If list1.c is changed or the layout of the source
326
  # window is changed, this must be updated.
327
  if {![catch {set z [$twin dump -tag 1.0 end]}]} {
328
    foreach {k v i} $z {
329
      if {$k == "tagon"} {
330
        if {$v == "BROWSE_TAG"} {
331
          if {$i == "38.2"} {
332
            set line_number [$twin get "$i wordstart" "$i wordend"]
333
            if {$line_number == "38"} {
334
              incr r
335
            } else {
336
              incr r -100
337
            }
338
          } else {
339
            incr r 5
340
          }
341
        }
342
        if {$v == "STACK_TAG"} {incr r 10}
343
        if {$v == "PC_TAG"} {incr r 100}
344
      }
345
    }
346
  } else {
347
    set r -1
348
  }
349
 
350
  if {$r == 1} {
351
    # things are OK so far, so just verify the function name is displayed
352
    # in the combobox entry field.
353
    set names [$statbar.func get]
354
    if {[string compare $names "oof"]} {set r -2}
355
  }
356
  set r
357
} {1}
358
 
359
# Test: srcwin2-2.8
360
# Desc: This test issues a next command while browsing list1.c.
361
# It should display list0.c and highlight the correct line.
362
gdbtk_test srcwin2-2.8 "step while browsing" {
363
  gdb_immediate "next" 1
364
  set r 0
365
  set name [$statbar.name get]
366
  set func [$statbar.func get]
367
 
368
  # check contents of name and function comboboxes
369
  if {$name != "list0.c"} {set r -1}
370
  if {$func != "main"} {set r -2}
371
 
372
  # check that correct file is displayed
373
  set twin [$stw test_get twin]
374
  set a [$twin get 1.0 end]
375
  if {[string compare $file1(source) $a]} {set r -3}
376
 
377
  # check for PC_TAG
378
  if {$r == 0} {
379
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
380
      foreach {k v i} $z {
381
        if {$k == "tagon"} {
382
          if {$v == "PC_TAG"} {
383
            incr r
384
          }
385
          if {$v == "STACK_TAG"} {incr r 10}
386
          if {$v == "BROWSE_TAG"} {incr r 100}
387
        }
388
      }
389
    } else {
390
      set r -4
391
    }
392
  }
393
  set r
394
} {1}
395
 
396
# Test: srcwin2-2.11
397
# Desc: This test issues a break and a continue
398
gdbtk_test srcwin2-2.11 "set BP and continue" {
399
  gdb_immediate "break oof" 1
400
  gdb_immediate "continue" 1
401
  set r 0
402
  set name [$statbar.name get]
403
  set func [$statbar.func get]
404
 
405
  # check contents of name and function comboboxes
406
  if {$name != "list1.c"} {set r -1}
407
  if {$func != "oof"} {set r -2}
408
 
409
  # check that the correct file is displayed
410
  # we must clear the breakpoint first so it doesn't mess up the
411
  # comparison...
412
  gdb_immediate "clear oof" 1
413
  set twin [$stw test_get twin]
414
  set a [$twin get 1.0 end]
415
  if {[string compare $file2(source) $a]} {set r -3}
416
 
417
  # check for PC_TAG on correct line
418
  if {$r == 0} {
419
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
420
      foreach {k v i} $z {
421
        if {$k == "tagon"} {
422
          if {$v == "PC_TAG"} {
423
            if {$i == "38.2"} {
424
              incr r
425
            } else {
426
              incr r 5
427
            }
428
          }
429
          if {$v == "STACK_TAG"} {incr r 10}
430
          if {$v == "BROWSE_TAG"} {incr r 100}
431
        }
432
      }
433
    } else {
434
      set r -4
435
    }
436
  }
437
  set r
438
} {1}
439
 
440
#####                       #####
441
#                               #
442
#  SECTION 3: Stack Operations  #
443
#                               #
444
#####                       #####
445
 
446
# Test: srcwin2-3.1
447
# Desc: This tests "stack up"
448
gdbtk_test srcwin2-3.1 "stack up (1)" {
449
  $srcwin stack up
450
  set r 0
451
  set name [$statbar.name get]
452
  set func [$statbar.func get]
453
 
454
  # check contents of name and function comboboxes
455
  if {$name != "list1.c"} {set r -1}
456
  if {$func != "long_line"} {set r -2}
457
 
458
  # check that the correct file is displayed
459
  set twin [$stw test_get twin]
460
  set a [$twin get 1.0 end]
461
  if {[string compare $file2(source) $a]} {set r -3}
462
 
463
  # check for PC_TAG and STACK_TAG on correct lines
464
  if {$r == 0} {
465
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
466
      foreach {k v i} $z {
467
        if {$k == "tagon"} {
468
          if {$v == "PC_TAG"} {
469
            if {$i == "38.2"} {
470
              incr r
471
            } else {
472
              incr r 5
473
            }
474
          }
475
          if {$v == "STACK_TAG"} {
476
            if {$i == "26.2"} {
477
              incr r
478
            } else {
479
              incr r 10
480
            }
481
          }
482
          if {$v == "BROWSE_TAG"} {incr r 100}
483
        }
484
      }
485
    } else {
486
      set r -4
487
    }
488
  }
489
  set r
490
} {2}
491
 
492
# Test: srcwin2-3.2
493
# Desc: Another "stack up"  test
494
gdbtk_test srcwin2-3.2 "stack up (2)" {
495
  $srcwin stack up
496
  set r 0
497
  set name [$statbar.name get]
498
  set func [$statbar.func get]
499
 
500
  # check contents of name and function comboboxes
501
  if {$name != "list1.c"} {set r -1}
502
  if {$func != "bar"} {set r -2}
503
 
504
  # check that the correct file is displayed
505
  set twin [$stw test_get twin]
506
  set a [$twin get 1.0 end]
507
  if {[string compare $file2(source) $a]} {set r -3}
508
 
509
  # check for PC_TAG and STACK_TAG on correct lines
510
  if {$r == 0} {
511
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
512
      foreach {k v i} $z {
513
        if {$k == "tagon"} {
514
          if {$v == "PC_TAG"} {
515
            if {$i == "38.2"} {
516
              incr r
517
            } else {
518
              incr r 5
519
            }
520
          }
521
          if {$v == "STACK_TAG"} {
522
            if {$i == "12.2"} {
523
              incr r
524
            } else {
525
              incr r 10
526
            }
527
          }
528
          if {$v == "BROWSE_TAG"} {incr r 100}
529
        }
530
      }
531
    } else {
532
      set r -4
533
    }
534
  }
535
  set r
536
} {2}
537
 
538
# Test: srcwin2-3.3
539
# Desc: Another "stack up"  test
540
gdbtk_test srcwin2-3.3 "stack up (3)" {
541
  $srcwin stack up
542
  set r 0
543
  set name [$statbar.name get]
544
  set func [$statbar.func get]
545
 
546
  # check contents of name and function comboboxes
547
  if {$name != "list0.h"} {set r -1}
548
  if {$func != "foo"} {set r -2}
549
 
550
  # check that the correct file is displayed
551
  set twin [$stw test_get twin]
552
  set file3(source) [$twin get 1.0 end]
553
  if {![string compare $file2(source) $file3(source)]} {set r -3}
554
 
555
  # check for PC_TAG and STACK_TAG on correct lines
556
  if {$r == 0} {
557
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
558
      foreach {k v i} $z {
559
        if {$k == "tagon"} {
560
          if {$v == "STACK_TAG"} {
561
            if {$i == "9.2"} {
562
              incr r
563
            } else {
564
              incr r 5
565
            }
566
          }
567
          if {$v == "PC_TAG"} {incr r 10}
568
          if {$v == "BROWSE_TAG"} {incr r 100}
569
        }
570
      }
571
    } else {
572
      set r -4
573
    }
574
  }
575
  set r
576
} {1}
577
 
578
# Test: srcwin2-3.4
579
# Desc: Another "stack up"  test
580
gdbtk_test srcwin2-3.4 "stack up (4)" {
581
  $srcwin stack up
582
  set r 0
583
  set name [$statbar.name get]
584
  set func [$statbar.func get]
585
 
586
  # check contents of name and function comboboxes
587
  if {$name != "list0.c"} {set r -1}
588
  if {$func != "main"} {set r -2}
589
 
590
  # check that the correct file is displayed
591
  set twin [$stw test_get twin]
592
  set a [$twin get 1.0 end]
593
  if {[string compare $file1(source) $a]} {set r -3}
594
 
595
  # check for STACK_TAG
596
  if {$r == 0} {
597
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
598
      foreach {k v i} $z {
599
        if {$k == "tagon"} {
600
          if {$v == "STACK_TAG"} {
601
            incr r
602
          }
603
          if {$v == "PC_TAG"} {incr r 10}
604
          if {$v == "BROWSE_TAG"} {incr r 100}
605
        }
606
      }
607
    } else {
608
      set r -4
609
    }
610
  }
611
  set r
612
} {1}
613
 
614
 
615
# Disabled for now because there are different correct results.
616
# Test should be rewritten to include those.
617
# Test: srcwin2-3.5
618
# Desc: "stack up" when we are at the top
619
#gdbtk_test srcwin2-3.5 "stack up when at the top" {
620
# $srcwin stack up
621
#  set r 0
622
#  set name [$statbar.name get]
623
#  set func [$statbar.func get]
624
 
625
  # check contents of name and function comboboxes
626
#  if {$name != "list0.c"} {set r -1}
627
#  if {$func != "main"} {set r -2}
628
 
629
  # check that the correct file is displayed
630
#  set twin [$stw test_get twin]
631
#  set a [$twin get 1.0 end]
632
#  if {[string compare $file1(source) $a]} {set r -3}
633
 
634
  # check for STACK_TAG
635
#  if {$r == 0} {
636
#    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
637
#      foreach {k v i} $z {
638
#       if {$k == "tagon"} {
639
#         if {$v == "STACK_TAG"} {
640
#           incr r
641
#         }
642
#         if {$v == "PC_TAG"} {incr r 10}
643
#         if {$v == "BROWSE_TAG"} {incr r 100}
644
#       }
645
#      }
646
#    } else {
647
#      set r -4
648
#    }
649
#  }
650
#  set r
651
#} {1}
652
 
653
# Test: srcwin2-3.6
654
# Desc: "stack down"  test
655
gdbtk_test srcwin2-3.6 "stack down" {
656
  $srcwin stack down
657
  set r 0
658
  set name [$statbar.name get]
659
  set func [$statbar.func get]
660
 
661
  # check contents of name and function comboboxes
662
  if {$name != "list0.h"} {set r -1}
663
  if {$func != "foo"} {set r -2}
664
 
665
  # check that the correct file is displayed
666
  set twin [$stw test_get twin]
667
  set a [$twin get 1.0 end]
668
  if {![string compare $file2(source) $a]} {set r -3}
669
 
670
  # check for PC_TAG and STACK_TAG on correct lines
671
  if {$r == 0} {
672
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
673
      foreach {k v i} $z {
674
        if {$k == "tagon"} {
675
          if {$v == "STACK_TAG"} {
676
            if {$i == "9.2"} {
677
              incr r
678
            } else {
679
              incr r 5
680
            }
681
          }
682
          if {$v == "PC_TAG"} {incr r 10}
683
          if {$v == "BROWSE_TAG"} {incr r 100}
684
        }
685
      }
686
    } else {
687
      set r -4
688
    }
689
  }
690
  set r
691
} {1}
692
 
693
# Test: srcwin2-3.7
694
# Desc: "stack bottom"  test
695
gdbtk_test srcwin2-3.7 "stack bottom" {
696
  $srcwin stack bottom
697
  set r 0
698
  set name [$statbar.name get]
699
  set func [$statbar.func get]
700
 
701
  # check contents of name and function comboboxes
702
  if {$name != "list1.c"} {set r -1}
703
  if {$func != "oof"} {set r -2}
704
 
705
  # check that the correct file is displayed
706
  set twin [$stw test_get twin]
707
  set a [$twin get 1.0 end]
708
  if {[string compare $file2(source) $a]} {set r -3}
709
 
710
  # check for PC_TAG on correct line
711
  if {$r == 0} {
712
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
713
      foreach {k v i} $z {
714
        if {$k == "tagon"} {
715
          if {$v == "PC_TAG"} {
716
            if {$i == "38.2"} {
717
              incr r
718
            } else {
719
              incr r 5
720
            }
721
          }
722
          if {$v == "STACK_TAG"} {incr r 10}
723
          if {$v == "BROWSE_TAG"} {incr r 100}
724
        }
725
      }
726
    } else {
727
      set r -4
728
    }
729
  }
730
  set r
731
} {1}
732
 
733
# Test: srcwin2-3.8
734
# Desc: "stack down" when at bottom
735
gdbtk_test srcwin2-3.8 "stack down when at bottom" {
736
  $srcwin stack down
737
  set r 0
738
  set name [$statbar.name get]
739
  set func [$statbar.func get]
740
 
741
  # check contents of name and function comboboxes
742
  if {$name != "list1.c"} {set r -1}
743
  if {$func != "oof"} {set r -2}
744
 
745
  # check that the correct file is displayed
746
  set twin [$stw test_get twin]
747
  set a [$twin get 1.0 end]
748
  if {[string compare $file2(source) $a]} {set r -3}
749
 
750
  # check for PC_TAG on correct line
751
  if {$r == 0} {
752
    if {![catch {set z [$twin dump -tag 1.0 end]}]} {
753
      foreach {k v i} $z {
754
        if {$k == "tagon"} {
755
          if {$v == "PC_TAG"} {
756
            if {$i == "38.2"} {
757
              incr r
758
            } else {
759
              incr r 5
760
            }
761
          }
762
          if {$v == "STACK_TAG"} {incr r 10}
763
          if {$v == "BROWSE_TAG"} {incr r 100}
764
        }
765
      }
766
    } else {
767
      set r -4
768
    }
769
  }
770
  set r
771
} {1}
772
 
773
# 4.1 bp, multiple, balloon, etc
774
 
775
# Test: srcwin2-4.1
776
# Desc: Set BP in another file. Tests bp and cache functions
777
gdbtk_test srcwin2-4.1 "set BP in another file" {
778
  gdb_immediate "break foo" 1
779
  $srcwin goto_func "" foo
780
  set r 0
781
  set name [$statbar.name get]
782
  set func [$statbar.func get]
783
 
784
  # check contents of name and function comboboxes
785
  if {$name != "list0.h"} {set r -1}
786
  if {$func != "foo"} {set r -2}
787
 
788
  set twin [$stw test_get twin]
789
 
790
  # check for BROWSE_TAG and BP image on correct line
791
  if {$r == 0} {
792
    if {![catch {set z [$twin dump 1.0 end]}]} {
793
      foreach {k v i} $z {
794
        if {$k == "tagon"} {
795
          if {$v == "BROWSE_TAG"} {
796
            if {$i == "9.2"} {
797
              incr r
798
            } else {
799
              incr r 5
800
            }
801
          }
802
          if {$v == "STACK_TAG"} {incr r 10}
803
          if {$v == "PC_TAG"} {incr r 100}
804
        } elseif {$k == "image"} {
805
          if {$i == "9.0"} {
806
            incr r
807
          } else {
808
            set r -200
809
          }
810
        }
811
      }
812
    } else {
813
      set r -4
814
    }
815
  }
816
 
817
  if {$r == 2} {
818
    # clear BP and compare with previous contents. This should succeed,
819
    gdb_immediate "clear foo" 1
820
    set a [$twin get 1.0 end]
821
    if {[string compare $file3(source) $a]} {set r -3}
822
  }
823
 
824
  set r
825
} {2}
826
 
827
# Test: srcwin2-4.2
828
# Desc: Test temporary BP
829
gdbtk_test srcwin2-4.2 "temporary BP" {
830
  set r 0
831
  if {[catch {gdb_immediate "tbreak foo" 1} msg]} {
832
    set r -500
833
  }
834
  set name [$statbar.name get]
835
  set func [$statbar.func get]
836
 
837
  # check contents of name and function comboboxes
838
  if {$name != "list0.h"} {set r -1}
839
  if {$func != "foo"} {set r -2}
840
 
841
  set twin [$stw test_get twin]
842
 
843
  # check for BROWSE_TAG and BP image on correct line
844
  if {$r == 0} {
845
    if {![catch {set z [$twin dump 1.0 end]}]} {
846
      foreach {k v i} $z {
847
        if {$k == "tagon"} {
848
          if {$v == "BROWSE_TAG"} {
849
            if {$i == "9.2"} {
850
              incr r
851
            } else {
852
              incr r 5
853
            }
854
          }
855
          if {$v == "STACK_TAG"} {incr r 10}
856
          if {$v == "PC_TAG"} {incr r 100}
857
        } elseif {$k == "image"} {
858
          if {$i == "9.0"} {
859
            incr r
860
          } else {
861
            set r -200
862
          }
863
        }
864
      }
865
    } else {
866
      set r -4
867
    }
868
  }
869
 
870
  gdb_immediate "continue" 1
871
 
872
  # now check for PC_TAG and no image
873
  if {$r == 2} {
874
    if {![catch {set z [$twin dump 1.0 end]}]} {
875
      foreach {k v i} $z {
876
        if {$k == "tagon"} {
877
          if {$v == "PC_TAG"} {
878
            if {$i == "9.2"} {
879
              incr r
880
            } else {
881
              incr r 5
882
            }
883
          }
884
          if {$v == "STACK_TAG"} {incr r 10}
885
          if {$v == "BROWSE_TAG"} {incr r 100}
886
        } elseif {$k == "image"} {
887
          set r -200
888
        }
889
      }
890
    } else {
891
      set r -4
892
    }
893
  }
894
 
895
  set r
896
} {3}
897
 
898
gdbtk_test_done

powered by: WebSVN 2.1.0

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