]],[0],[expout])
AT_CLEANUP
+
+# ===
+# source list mode dwarf-4
+# ===
+AT_SETUP([debugedit --list-file DWARF4])
+AT_KEYWORDS([debuginfo] [debugedit])
+echo "int main () { }" > main.c
+$CC $CFLAGS -gdwarf-4 -o main main.c
+AT_CHECK([[debugedit -l sources.list main]])
+AT_CHECK([[grep -q main.c sources.list]])
+cat sources.list
+AT_CLEANUP
+
+# ===
+# source list mode dwarf-5
+# ===
+AT_SETUP([debugedit --list-file DWARF5])
+AT_KEYWORDS([debuginfo] [debugedit])
+AT_SKIP_IF([test "$GDWARF_5_FLAG" = "no"])
+echo "int main () { }" > main.c
+$CC $CFLAGS -gdwarf-5 -o main main.c
+AT_CHECK([[debugedit -l sources.list main]])
+AT_CHECK([[grep -q main.c sources.list]])
+AT_CLEANUP
/* file_names_count */
unsigned entry_count = read_uleb128 (*ptrp);
- bool collecting_dirs = dest_dir && phase == 0 && *dirs == NULL;
- bool writing_files = dest_dir && phase == 0 && *dirs != NULL;
+ bool collecting_dirs = phase == 0 && *dirs == NULL;
+ bool writing_files = phase == 0 && *dirs != NULL;
if (collecting_dirs)
{
*ndir = entry_count;
{
case DW_FORM_strp:
case DW_FORM_line_strp:
- if (dest_dir && phase == 0)
+ if (phase == 0)
{
size_t idx = do_read_32_relocated (*ptrp);
- if (record_file_string_entry_idx (line_strp, dso, idx))
+ if (dest_dir)
{
- if (line_strp)
- need_line_strp_update = true;
- else
- need_strp_update = true;
+ if (record_file_string_entry_idx (line_strp, dso,
+ idx))
+ {
+ if (line_strp)
+ need_line_strp_update = true;
+ else
+ need_strp_update = true;
+ }
}
handled_strp = true;
if (collecting_dirs || writing_files)
if (writing_files)
{
char *comp_dir = (*dirs)[0];
- size_t comp_dir_len = strlen(comp_dir);
+ size_t comp_dir_len = !comp_dir ? 0 : strlen(comp_dir);
size_t file_len = strlen (file);
size_t dir_len = strlen (dir);