The answer to your firstthe title question is that the problem is unsolvable. See p. 194 of Lyndon and Schupp's Combinatorial Group Theory, where it is called the "generating problem." It is unsolvable even when $G$ is the direct product of free groups of rank at least 6.