~ubuntu-branches/ubuntu/karmic/dejagnu/karmic

« back to all changes in this revision

Viewing changes to config/gdb-comm.exp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Jacobowitz
  • Date: 2006-12-11 09:06:59 UTC
  • mfrom: (2.1.6 edgy)
  • Revision ID: james.westby@ubuntu.com-20061211090659-w586kgi3giz84053
Tags: 1.4.4.cvs20060709-3
* Acknowledge previous NMUs.
* Fix permissions on /usr/share/dejagnu when building without fakeroot
  (Closes: #392589, #379809).

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with DejaGnu; if not, write to the Free Software Foundation,
18
 
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
19
19
 
20
20
# Note: some of this was cribbed from the gdb testsuite since we need
21
21
# to use some pretty standard gdb features (breakpoints in particular).
23
23
# Load up some standard junk.
24
24
load_lib remote.exp
25
25
 
26
 
if ![info exists board] {
 
26
if {![info exists board]} {
27
27
    perror "$board must be set before loading gdb-comm"
28
28
}
29
29
 
69
69
 
70
70
    # The "file" command loads up a new symbol file for gdb, deal with
71
71
    # the various messages it might spew out.
72
 
    if [is_remote host] {
 
72
    if {[is_remote host]} {
73
73
        set arg [remote_download host $arg a.out]
74
74
    }
75
75
    remote_send host "file $arg\n"
129
129
proc gdb_comm_go_idle { } {
130
130
    global gdb_prompt
131
131
 
132
 
    if ![board_info host exists fileid] {
 
132
    if {![board_info host exists fileid]} {
133
133
        return -1
134
134
    }
135
135
 
157
157
 
158
158
    # The variable gdb_prompt is a regexp which matches the gdb prompt.  Set it
159
159
    # if it is not already set.
160
 
    if ![board_info $dest exists gdb_prompt] then {
 
160
    if {![board_info $dest exists gdb_prompt]} then {
161
161
        set gdb_prompt "\\(gdb\\)"
162
162
    } else {
163
163
        set gdb_prompt [board_info $dest gdb_prompt]
164
164
    }
165
165
    # Similarly for GDB.  Look in the object directory for gdb if we aren't
166
166
    # provided with one.
167
 
    if ![info exists GDB] then {
 
167
    if {![info exists GDB]} then {
168
168
        set GDB "[lookfor_file ${tool_root_dir} gdb/gdb]"
169
169
        if { $GDB == "" } {
170
170
            set GDB [transform gdb]
171
171
        }
172
172
    }
173
 
    if [board_info host exists gdb_opts] {
 
173
    if {[board_info host exists gdb_opts]} {
174
174
        set gdb_opts [board_info host gdb_opts]
175
175
    } else {
176
176
        set gdb_opts ""
227
227
            }
228
228
        }
229
229
    }
230
 
    if ![is_remote host] {
 
230
    if {![is_remote host]} {
231
231
        remote_close host
232
232
    }
233
233
}
234
234
 
235
235
proc gdb_comm_leave { } {
236
 
    if [is_remote host] {
 
236
    if {[is_remote host]} {
237
237
        quit_gdb
238
238
    } else {
239
239
        gdb_comm_go_idle
259
259
        }
260
260
    }
261
261
    # Make sure the file we're supposed to load really exists.
262
 
    if ![file exists $prog] then {
 
262
    if {![file exists $prog]} then {
263
263
        perror "$prog does not exist."
264
264
        return [list "untested" ""]
265
265
    }
278
278
        gdb_comm_leave
279
279
        return [gdb_comm_reload $dest $prog $args]
280
280
    }
281
 
    if [board_info $dest exists gdb_sect_offset] {
 
281
    if {[board_info $dest exists gdb_sect_offset]} {
282
282
        set textoff [board_info $dest gdb_sect_offset]
283
283
        remote_send host "sect .text $textoff\n"
284
284
        remote_expect host 10 {
292
292
            }
293
293
            -re "$gdb_prompt" { }
294
294
        }
295
 
        set dataoff [format 0x%x [expr $dataoff + $textoff]]
296
 
        set bssoff [format 0x%x [expr $bssoff + $textoff]]
 
295
        set dataoff [format 0x%x [expr {$dataoff + $textoff}]]
 
296
        set bssoff [format 0x%x [expr {$bssoff + $textoff}]]
297
297
        remote_send host "sect .data $dataoff\n"
298
298
        remote_expect host 10 {
299
299
            -re "$gdb_prompt" { }
315
315
    gdb_comm_add_breakpoint abort
316
316
 
317
317
    set protocol [board_info $dest gdb_protocol]
318
 
    if [board_info $dest exists gdb_serial] {
 
318
    if {[board_info $dest exists gdb_serial]} {
319
319
        set targetname [board_info $dest gdb_serial]
320
 
    } elseif [board_info $dest exists netport] {
 
320
    } elseif {[board_info $dest exists netport]} {
321
321
        set targetname [board_info $dest netport]
322
322
    } else {
323
 
        if [board_info $dest exists serial] {
 
323
        if {[board_info $dest exists serial]} {
324
324
            set targetname [board_info $dest serial]
325
325
        } else {
326
326
            set targetname ""
327
327
        }
328
328
    }
329
 
    if [board_info $dest exists baud] {
 
329
    if {[board_info $dest exists baud]} {
330
330
        remote_send host "set remotebaud [board_info $dest baud]\n"
331
331
        remote_expect host 10 {
332
332
            -re ".*$gdb_prompt $" {}
369
369
        }
370
370
    }
371
371
 
372
 
    if [target_info exists gdb_init_command] {
 
372
    if {[target_info exists gdb_init_command]} {
373
373
        remote_send host "[target_info gdb_init_command]\n"
374
374
        remote_expect host 10 {
375
375
            -re ".*$gdb_prompt $" { }
381
381
    }
382
382
    # Now download the executable to the target board.  If communications
383
383
    # with the target are very slow the timeout might need to be increased.
384
 
    if [board_info $dest exists gdb_load_offset] {
 
384
    if {[board_info $dest exists gdb_load_offset]} {
385
385
        remote_send host "load $prog [board_info $dest gdb_load_offset]\n"
386
386
    } else {
387
387
        remote_send host "load\n"
406
406
    # Now start up the program and look for our magic breakpoints.
407
407
    # And a whole lot of other magic stuff too.
408
408
 
409
 
    if [board_info $dest exists gdb_run_command] {
 
409
    if {[board_info $dest exists gdb_run_command]} {
410
410
        remote_send host "[board_info $dest gdb_run_command]\n"
411
411
    } else {
412
412
        remote_send host "run\n"
413
413
    }
414
414
    # FIXME: The value 300 below should be a parameter.
415
 
    if [board_info $dest exists testcase_timeout] {
 
415
    if {[board_info $dest exists testcase_timeout]} {
416
416
        set testcase_timeout [board_info $dest testcase_timeout]
417
417
    } else {
418
418
        set testcase_timeout 300
460
460
            if { $result == 0 } {
461
461
                return [list "pass" $output]
462
462
            }
463
 
            if [board_info $dest exists exit_statuses_bad] {
 
463
            if {[board_info $dest exists exit_statuses_bad]} {
464
464
                return [list "pass" $output]
465
465
            }
466
466
            return [list "fail" $output]
501
501
        }
502
502
        default {
503
503
            gdb_comm_leave
504
 
            if [board_info $dest exists unreliable] {
 
504
            if {[board_info $dest exists unreliable]} {
505
505
                if { [board_info $dest unreliable] > 0 } {
506
506
                    global board_info
507
507
                    set name [board_info $dest name]