Guided Debugging of Auto-Translated Code Using Differential Testing

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Wu, Shengnan, Sun, Xinyu, Wang, Xin, Zhou, Yangfan
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866916568448892928
author Wu, Shengnan
Sun, Xinyu
Wang, Xin
Zhou, Yangfan
author_facet Wu, Shengnan
Sun, Xinyu
Wang, Xin
Zhou, Yangfan
contents Large Language Models (LLMs) hold great promise in the task of code translation. However, the lack of explainability complicates the identification of the inevitable translation errors. In this paper, we propose tHinter, a debugging tool to locate translation errors in auto-translated code. The core idea of tHinter is that correctly translated, the source and translated code should present the same functionalities, giving the same output for the same input. Hence, lines in the translated code responsible for output differences are possibly translation errors. First, tHinter employs fuzzing to generate diverse test cases that thoroughly explore the translated code. Then, tHinter relies on a heuristic algorithm to pinpoint translation errors from coverage information and differential testing execution results of those test cases. This heuristic algorithm is designed to leverage both the statistics and the expertise of developers. Comprehensive experiments with real code show its effectiveness. It reduces 71% lines developers need to review during debugging and increases the likelihood of the LLM fixing translation errors in a single query by 59%. Developers generally consider it satisfactory and helpful.
format Preprint
id arxiv_https___arxiv_org_abs_2501_09475
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Guided Debugging of Auto-Translated Code Using Differential Testing
Wu, Shengnan
Sun, Xinyu
Wang, Xin
Zhou, Yangfan
Software Engineering
Large Language Models (LLMs) hold great promise in the task of code translation. However, the lack of explainability complicates the identification of the inevitable translation errors. In this paper, we propose tHinter, a debugging tool to locate translation errors in auto-translated code. The core idea of tHinter is that correctly translated, the source and translated code should present the same functionalities, giving the same output for the same input. Hence, lines in the translated code responsible for output differences are possibly translation errors. First, tHinter employs fuzzing to generate diverse test cases that thoroughly explore the translated code. Then, tHinter relies on a heuristic algorithm to pinpoint translation errors from coverage information and differential testing execution results of those test cases. This heuristic algorithm is designed to leverage both the statistics and the expertise of developers. Comprehensive experiments with real code show its effectiveness. It reduces 71% lines developers need to review during debugging and increases the likelihood of the LLM fixing translation errors in a single query by 59%. Developers generally consider it satisfactory and helpful.
title Guided Debugging of Auto-Translated Code Using Differential Testing
topic Software Engineering
url https://arxiv.org/abs/2501.09475