Let A 0 , . . . , A n be m × m symmetric matrices with entries in Q, and let A(x) be the linear pencil A 0 + x 1 A 1 + · · · + x n A n , where x = (x 1 , . . . , x n ) are unknowns. The linear matrix inequality (LMI) A(x) 0 defines the subset of R n , called spectrahedron, containing all points x such that A(x) has non-negative eigenvalues. The minimization of linear functions over spectrahedra is called semidefinite programming (SDP). Such problems appear frequently in control theory and real algebra, especially in the context of nonnegativity certificates for multivariate polynomials based on sums of squares.Numerical software for solving SDP are mostly based on the interior point method, assuming some non-degeneracy properties such as the existence of interior points in the admissible set. In this paper, we design an exact algorithm based on symbolic homotopy for solving semidefinite programs without assumptions on the feasible set, and we analyze its complexity. Because of the exactness of the output, it cannot compete with numerical routines in practice but we prove that solving such problems can be done in polynomial time if either n or m is fixed.