What will the doctor do if you go to the doctor with a problem with black stool?

Look for bleeding. Evaluate if you are bleeding and if so likely recommend an endoscopy.
Melenic stool? Dark-colored stools may result from iron supplements, foods you eat (like a lot of spinach), substances (like peptobismol), but most significantly suggests bleeding. When blood is denatured by acid in your stomach, as from ulcers, stools will turn tarry ("melena"). Blood may also be ingested from nose bleeds, bleeding gums... Persistent melena (without obvious cause) & symptoms warrants md visit.