예제 #1
0
def test_echo_pipe() -> None:
    line = 'addr 0xffffffffc084eee0 | addr global_void_ptr'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 2
    assert ret[0].value_() == 0xffffffffc084eee0
    assert sdb.type_equals(ret[0].type_, MOCK_PROGRAM.type('void *'))
    assert ret[1].value_() == 0xffff88d26353c108
    assert sdb.type_equals(ret[1].type_, MOCK_PROGRAM.type('void **'))
예제 #2
0
파일: test_echo.py 프로젝트: sravyamks/sdb
def test_multiple_args() -> None:
    line = 'echo 0 1'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 2
    assert ret[0].value_() == 0
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
    assert ret[1].value_() == 1
    assert ret[1].type_ == MOCK_PROGRAM.type('void *')
예제 #3
0
파일: test_address.py 프로젝트: shartse/sdb
def test_echo_pipe():
    line = 'addr 0xffffffffc084eee0 | addr global_void_ptr'
    objs = []

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 2
    assert ret[0].value_() == 0xffffffffc084eee0
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
    assert ret[1].value_() == 0xffff88d26353c108
    assert ret[1].type_ == MOCK_PROGRAM.type('void **')
예제 #4
0
def test_piped_invocations() -> None:
    line = 'addr global_int | addr 0xffffffffc084eee0 global_void_ptr'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 3
    assert ret[0].value_() == 0xffffffffc0000000
    assert sdb.type_equals(ret[0].type_, MOCK_PROGRAM.type('int *'))
    assert ret[1].value_() == 0xffffffffc084eee0
    assert sdb.type_equals(ret[1].type_, MOCK_PROGRAM.type('void *'))
    assert ret[2].value_() == 0xffff88d26353c108
    assert sdb.type_equals(ret[2].type_, MOCK_PROGRAM.type('void **'))
예제 #5
0
파일: test_address.py 프로젝트: shartse/sdb
def test_piped_invocations():
    line = 'addr global_int | addr 0xffffffffc084eee0 global_void_ptr'
    objs = []

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 3
    assert ret[0].value_() == 0xffffffffc0000000
    assert ret[0].type_ == MOCK_PROGRAM.type('int *')
    assert ret[1].value_() == 0xffffffffc084eee0
    assert ret[1].type_ == MOCK_PROGRAM.type('void *')
    assert ret[2].value_() == 0xffff88d26353c108
    assert ret[2].type_ == MOCK_PROGRAM.type('void **')
예제 #6
0
파일: test_echo.py 프로젝트: shartse/sdb
def test_multiple_piped():
    line = 'echo'
    objs = [
        drgn.Object(MOCK_PROGRAM, 'void *', value=0),
        drgn.Object(MOCK_PROGRAM, 'int', value=1),
    ]

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 2
    assert ret[0].value_() == 0
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
    assert ret[1].value_() == 1
    assert ret[1].type_ == MOCK_PROGRAM.type('int')
예제 #7
0
def test_multi_void_ptr_input_value_match_ne() -> None:
    line = 'filter "obj != 1"'
    objs = [
        drgn.Object(MOCK_PROGRAM, 'void *', value=0),
        drgn.Object(MOCK_PROGRAM, 'void *', value=1),
        drgn.Object(MOCK_PROGRAM, 'void *', value=2),
    ]

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 2
    assert ret[0].value_() == 0
    assert sdb.type_equals(ret[0].type_, MOCK_PROGRAM.type('void *'))
    assert ret[1].value_() == 2
    assert sdb.type_equals(ret[1].type_, MOCK_PROGRAM.type('void *'))
예제 #8
0
def test_single_arg_decimal() -> None:
    line = 'echo 0'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 1
    assert ret[0].value_() == 0
    assert sdb.type_equals(ret[0].type_, MOCK_PROGRAM.type('void *'))
예제 #9
0
def test_single_object() -> None:
    line = 'addr global_int'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 1
    assert ret[0].value_() == 0xffffffffc0000000
    assert sdb.type_equals(ret[0].type_, MOCK_PROGRAM.type('int *'))
예제 #10
0
파일: test_cast.py 프로젝트: sravyamks/sdb
def test_double_cast() -> None:
    line = 'addr global_int | cast unsigned int | cast char *'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 1
    assert ret[0].type_ == MOCK_PROGRAM.type('char *')
    assert ret[0].value_() == 0xc0000000
예제 #11
0
파일: test_cast.py 프로젝트: sravyamks/sdb
def test_str_pipe_input() -> None:
    line = 'addr global_int | cast void *'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 1
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
    assert ret[0].value_() == 0xffffffffc0000000
예제 #12
0
파일: test_cast.py 프로젝트: sravyamks/sdb
def test_pipe_input_pointer_to_int() -> None:
    line = 'addr global_int | cast unsigned int'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 1
    assert ret[0].type_ == MOCK_PROGRAM.type('unsigned int')
    assert ret[0].value_() == 0xc0000000
예제 #13
0
def test_plain_address() -> None:
    line = 'addr 0xffffffffc084eee0'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 1
    assert ret[0].value_() == 0xffffffffc084eee0
    assert sdb.type_equals(ret[0].type_, MOCK_PROGRAM.type('void *'))
예제 #14
0
파일: test_echo.py 프로젝트: sravyamks/sdb
def test_single_arg() -> None:
    line = 'echo 1'

    ret = invoke(MOCK_PROGRAM, [], line)

    assert len(ret) == 1
    assert ret[0].value_() == 1
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
예제 #15
0
파일: test_echo.py 프로젝트: shartse/sdb
def test_piped_and_args_combo():
    line = 'echo 0 1'
    objs = [
        drgn.Object(MOCK_PROGRAM, 'void *', value=0),
        drgn.Object(MOCK_PROGRAM, 'int', value=1),
    ]

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 4
    assert ret[0].value_() == 0
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
    assert ret[1].value_() == 1
    assert ret[1].type_ == MOCK_PROGRAM.type('int')
    assert ret[2].value_() == 0
    assert ret[2].type_ == MOCK_PROGRAM.type('void *')
    assert ret[3].value_() == 1
    assert ret[3].type_ == MOCK_PROGRAM.type('void *')
예제 #16
0
파일: test_cast.py 프로젝트: sravyamks/sdb
def test_invoke_pipe_input() -> None:
    line = 'cast void *'
    objs = [MOCK_PROGRAM['global_int']]

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 1
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
    assert ret[0].value_() == 0x01020304
예제 #17
0
파일: test_address.py 프로젝트: shartse/sdb
def test_single_object():
    line = 'addr global_int'
    objs = []

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 1
    assert ret[0].value_() == 0xffffffffc0000000
    assert ret[0].type_ == MOCK_PROGRAM.type('int *')
예제 #18
0
파일: test_echo.py 프로젝트: shartse/sdb
def test_single_arg():
    line = 'echo 1'
    objs = []

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 1
    assert ret[0].value_() == 1
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
예제 #19
0
파일: test_echo.py 프로젝트: shartse/sdb
def test_test_piped_int():
    line = 'echo'
    objs = [drgn.Object(MOCK_PROGRAM, 'int', value=1)]

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 1
    assert ret[0].value_() == 1
    assert ret[0].type_ == MOCK_PROGRAM.type('int')
예제 #20
0
파일: test_echo.py 프로젝트: shartse/sdb
def test_piped_input():
    line = 'echo'
    objs = [drgn.Object(MOCK_PROGRAM, 'void *', value=0)]

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 1
    assert ret[0].value_() == 0
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
예제 #21
0
파일: test_address.py 프로젝트: shartse/sdb
def test_plain_address():
    line = 'addr 0xffffffffc084eee0'
    objs = []

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 1
    assert ret[0].value_() == 0xffffffffc084eee0
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
예제 #22
0
파일: test_echo.py 프로젝트: shartse/sdb
def test_multi_echo_combo():
    line = 'echo 2 3 | echo 4'
    objs = [
        drgn.Object(MOCK_PROGRAM, 'void *', value=0),
        drgn.Object(MOCK_PROGRAM, 'int', value=1),
    ]

    ret = invoke(MOCK_PROGRAM, objs, line)

    assert len(ret) == 5
    assert ret[0].value_() == 0
    assert ret[0].type_ == MOCK_PROGRAM.type('void *')
    assert ret[1].value_() == 1
    assert ret[1].type_ == MOCK_PROGRAM.type('int')
    assert ret[2].value_() == 2
    assert ret[2].type_ == MOCK_PROGRAM.type('void *')
    assert ret[3].value_() == 3
    assert ret[3].type_ == MOCK_PROGRAM.type('void *')
    assert ret[4].value_() == 4
    assert ret[4].type_ == MOCK_PROGRAM.type('void *')