Find what unknown function does in C using gdb

Posted by Gary on Stack Overflow See other posts from Stack Overflow or by Gary
Published on 2010-03-31T01:57:58Z Indexed on 2010/03/31 2:03 UTC
Read the original article Hit count: 314

Filed under:
|

Hi,

I have a function m(int i, char c) which takes and returns a char between "-abc...xyz" and also takes an integer i.

Basically I have no way to see the source code of the function but can call it and get the return value. Using gdb/C, what's the best way to decipher what the function actually does? I've tried looking for patterns using consecutive chars and integer inputs but have come up with nothing yet.

If it helps, here are some results of testing the return values, with the first two bits being the arguments and the last bit being the return value:

0 a    i
0 b    l
0 c    t
0 d    x
0 e    f
0 f    v

1 a    q
1 b    i
1 c    y
1 d    e

2 a    a
2 b    y
2 c    f
2 d    n

© Stack Overflow or respective owner

Related posts about c

    Related posts about gdb