Some TeX implementations or macro packages provide the facility to automatically include so-called "source specials" into a .dvi file. These contain the line number, eventually a column number, and the filename of the .tex source. This makes it possible to jump from a .dvi file to the corresponding place in the .tex source and back (also called "reverse search" and "forward search"). I've asked for the same for .pdf files, and have got an answer from Will Robertson in comp.text.tex:
There have been two such attempts that I know of.
Heiko Oberdiek's vpe:
Haven't used it, but his reputation precedes him.
Jerome Laurens' pdfsync is more unofficial (not on CTAN, grrr), but I
believe it's supported in AucTeX these days:
(It's also got support in a couple of Mac OS X editor/frontends.)