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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.hp/] [gdb.objdbg/] [objdbg01.exp] - Diff between revs 107 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 107 Rev 1765
# Test reading debug information from in object files.
# Test reading debug information from in object files.
if { [skip_hp_tests] } { continue }
if { [skip_hp_tests] } { continue }
if { ![istarget "hppa*-*-hpux*"] } {
if { ![istarget "hppa*-*-hpux*"] } {
    verbose "HPUX test ignored for non-hppa targets."
    verbose "HPUX test ignored for non-hppa targets."
    return 0
    return 0
}
}
set testfile "test"
set testfile "test"
set srcsubdir ${srcdir}/${subdir}/objdbg01
set srcsubdir ${srcdir}/${subdir}/objdbg01
set toolssubdir ${srcdir}/${subdir}/tools
set toolssubdir ${srcdir}/${subdir}/tools
set objdbgdir ${objdir}/${subdir}/objdbg01
set objdbgdir ${objdir}/${subdir}/objdbg01
set binfile ${objdbgdir}/${testfile}
set binfile ${objdbgdir}/${testfile}
set symaddrfile ${toolssubdir}/symaddr
set symaddrfile ${toolssubdir}/symaddr
if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } {
if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } {
    gdb_suppress_entire_file "WARNING: +objdebug option is not supported in this compiler version, test ignored."
    gdb_suppress_entire_file "WARNING: +objdebug option is not supported in this compiler version, test ignored."
}
}
if { [gdb_compile "${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
if { [gdb_compile "${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
    perror "Couldn't compile x1.cc"
    perror "Couldn't compile x1.cc"
    return -1
    return -1
}
}
if { [gdb_compile "${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
if { [gdb_compile "${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
    perror "Couldn't compile x2.cc"
    perror "Couldn't compile x2.cc"
    return -1
    return -1
}
}
if { [gdb_compile "${srcsubdir}/x3.cc" "${objdbgdir}/x3.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
if { [gdb_compile "${srcsubdir}/x3.cc" "${objdbgdir}/x3.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
    perror "Couldn't compile x3.cc"
    perror "Couldn't compile x3.cc"
    return -1
    return -1
}
}
if { [gdb_compile "${objdbgdir}/x1.o ${objdbgdir}/x2.o ${objdbgdir}/x3.o" "${binfile}0" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
if { [gdb_compile "${objdbgdir}/x1.o ${objdbgdir}/x2.o ${objdbgdir}/x3.o" "${binfile}0" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
    perror "Couldn't compile ${binfile}0"
    perror "Couldn't compile ${binfile}0"
    return -1
    return -1
}
}
if {[gdb_compile "${objdbgdir}/x3.o ${objdbgdir}/x2.o ${objdbgdir}/x1.o" "${binfile}1" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
if {[gdb_compile "${objdbgdir}/x3.o ${objdbgdir}/x2.o ${objdbgdir}/x1.o" "${binfile}1" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
    perror "Couldn't compile ${binfile}1"
    perror "Couldn't compile ${binfile}1"
    return -1
    return -1
}
}
# Test two executables. The first has x1.cc linked first, the second
# Test two executables. The first has x1.cc linked first, the second
# has x3.cc linked first.  The difference is that in the first one,
# has x3.cc linked first.  The difference is that in the first one,
# the Info instantiation from x1.cc is taken, in the second, its
# the Info instantiation from x1.cc is taken, in the second, its
# from x3.cc.
# from x3.cc.
for {set filenum 0} {$filenum < 2} {incr filenum 1} {
for {set filenum 0} {$filenum < 2} {incr filenum 1} {
    # Lets test some commons
    # Lets test some commons
    # Need to restart each to to make sure objects are not loaded
    # Need to restart each to to make sure objects are not loaded
    # Also cross check the address with what is actually in the
    # Also cross check the address with what is actually in the
    #   object file (call the executable ${symaddrfile} to retrieve the
    #   object file (call the executable ${symaddrfile} to retrieve the
    #   information).
    #   information).
    set exec_output [lindex [remote_exec build "${symaddrfile} ${binfile}${filenum} acomm"] 1]
    set exec_output [lindex [remote_exec build "${symaddrfile} ${binfile}${filenum} acomm"] 1]
    regsub -all "\[\r\n\]" ${exec_output} "" exec_output
    regsub -all "\[\r\n\]" ${exec_output} "" exec_output
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "p &acomm" "..* = \\(int \[*\]\\) 0x${exec_output}.*"
    gdb_test "p &acomm" "..* = \\(int \[*\]\\) 0x${exec_output}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 20."
    gdb_test "b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 20."
    gdb_test "run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:20.*20.*acomm.*=.*1.*"
    gdb_test "run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:20.*20.*acomm.*=.*1.*"
    gdb_test "s 1" "21.*"
    gdb_test "s 1" "21.*"
    gdb_test "p acomm" ".* = 1.*"
    gdb_test "p acomm" ".* = 1.*"
    gdb_test "p &acomm" "..* = \\(int \[*\]\\) 0x${exec_output}.*"
    gdb_test "p &acomm" "..* = \\(int \[*\]\\) 0x${exec_output}.*"
    # Step through each line.
    # Step through each line.
    # Do this three times.
    # Do this three times.
    #   First round:  Test that things are okay after printing commons
    #   First round:  Test that things are okay after printing commons
    #                 above.
    #                 above.
    #   Second round: Restart gdb and make sure we can walk through
    #   Second round: Restart gdb and make sure we can walk through
    #   Third round:  Do NOT restrart gdb to verify that the debug information
    #   Third round:  Do NOT restrart gdb to verify that the debug information
    #                 was not messed up by loading additional object files from
    #                 was not messed up by loading additional object files from
    #                 the first run through.
    #                 the first run through.
    for {set i 0} {$i < 3} {incr i 1} {
    for {set i 0} {$i < 3} {incr i 1} {
        if $i==1 then {
        if $i==1 then {
            gdb_exit
            gdb_exit
            gdb_start
            gdb_start
            gdb_reinitialize_dir ${srcsubdir}
            gdb_reinitialize_dir ${srcsubdir}
            gdb_load ${binfile}${filenum}
            gdb_load ${binfile}${filenum}
        }
        }
        if $i!=2 then {
        if $i!=2 then {
            gdb_test "b main" \
            gdb_test "b main" \
                "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 20."
                "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 20."
        }
        }
        if $i!=0 then {
        if $i!=0 then {
            gdb_test "run" \
            gdb_test "run" \
                "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:20.*"
                "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:20.*"
            gdb_test "s 1" "21.*"
            gdb_test "s 1" "21.*"
        }
        }
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
        gdb_test "s 1" "PP::print .*/x2.cc:8.*"
        gdb_test "s 1" "PP::print .*/x2.cc:8.*"
        gdb_test "s 1" ".*9.*"
        gdb_test "s 1" ".*9.*"
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
        gdb_test "s 1" "main .*/x1.cc:22.*"
        gdb_test "s 1" "main .*/x1.cc:22.*"
        gdb_test "s 1" "foo .*/x3.cc:5.*"
        gdb_test "s 1" "foo .*/x3.cc:5.*"
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
        gdb_test "s 1" "PP::print .*/x2.cc:8.*"
        gdb_test "s 1" "PP::print .*/x2.cc:8.*"
        gdb_test "s 1" ".*9.*"
        gdb_test "s 1" ".*9.*"
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
        gdb_test "s 1" "foo .*/x3.cc:6.*"
        gdb_test "s 1" "foo .*/x3.cc:6.*"
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
        gdb_test "s 1" "Info::p .*/x3.h:11.*"
        gdb_test "s 1" "QQ::print .*/x2.cc:13.*"
        gdb_test "s 1" "QQ::print .*/x2.cc:13.*"
        gdb_test "s 1" ".*14.*"
        gdb_test "s 1" ".*14.*"
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
        gdb_test "s 1" "Info::p .*/x3.h:12.*"
        gdb_test "s 1" "foo .*/x3.cc:7.*"
        gdb_test "s 1" "foo .*/x3.cc:7.*"
        gdb_test "s 1" "main .*/x1.cc:24.*"
        gdb_test "s 1" "main .*/x1.cc:24.*"
        gdb_test "s 1" ".*25.*"
        gdb_test "s 1" ".*25.*"
        if [istarget "hppa2.0w-*-*"] {
        if [istarget "hppa2.0w-*-*"] {
            gdb_test "s 1" "0x\[0-9a-f\]+ in .*"
            gdb_test "s 1" "0x\[0-9a-f\]+ in .*"
            gdb_test "c" ".*Program exited normally.*"
            gdb_test "c" ".*Program exited normally.*"
        } else {
        } else {
            gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
            gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
            gdb_test "s 1" ".*Program exited normally.*"
            gdb_test "s 1" ".*Program exited normally.*"
        }
        }
    }
    }
    # Test various ptypes, and combinations of them
    # Test various ptypes, and combinations of them
    # Test things multiple times in each set to make sure that the debug
    # Test things multiple times in each set to make sure that the debug
    #   information did not get messed up.
    #   information did not get messed up.
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype Info" "type = template <..*> (class |)Info {..*}.*"
    gdb_test "ptype Info" "type = template <..*> (class |)Info {..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype Info" "type = template <..*> (class |)Info {..*}.*"
    gdb_test "ptype Info" "type = template <..*> (class |)Info {..*}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype class QQ" "type = (class |)QQ {..*void print( |)..*}.*"
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_test "ptype class PP" "type = (class |)PP {..*void print( |)..*}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype class Info" \
    gdb_test "ptype class Info" \
        "type = (class |)Info {..*void p( |)..*}.*"
        "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype class Info" \
    gdb_test "ptype class Info" \
        "type = (class |)Info {..*void p( |)..*}.*"
        "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype class Info" \
    gdb_test "ptype class Info" \
        "type = (class |)Info {..*void p( |)..*}.*"
        "type = (class |)Info {..*void p( |)..*}.*"
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir ${srcsubdir}
    gdb_reinitialize_dir ${srcsubdir}
    gdb_load ${binfile}${filenum}
    gdb_load ${binfile}${filenum}
    gdb_test "ptype class Info" \
    gdb_test "ptype class Info" \
        "type = (class |)Info {..*void p( |)..*}.*"
        "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype class Info" \
    gdb_test "ptype class Info" \
        "type = (class |)Info {..*void p( |)..*}.*"
        "type = (class |)Info {..*void p( |)..*}.*"
    gdb_test "ptype class Info" \
    gdb_test "ptype class Info" \
        "type = (class |)Info {..*void p( |)..*}.*"
        "type = (class |)Info {..*void p( |)..*}.*"
}
}
 
 

powered by: WebSVN 2.1.0

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