Bug 478211 - Redundant code for vgdb.c and Valgrind core tools
Summary: Redundant code for vgdb.c and Valgrind core tools
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-07 13:17 UTC by Alexandra Hajkova
Modified: 2023-12-08 13:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch (6.99 KB, patch)
2023-12-07 13:17 UTC, Alexandra Hajkova
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandra Hajkova 2023-12-07 13:17:15 UTC
Created attachment 163977 [details]
patch

There are some redundancies, some functions that are already present in remote-utils.c, used by valgrind were copied to vgdb.c. remote-utils.c/server.h provides functions for core valgrind code and tools. The reason vgdb can't directly use the functions provided there is that valgrind gdbserver cannot use libc, but vgdb can and does. 

The patch attached adds remote-utils-shared.c/.h for sharing code between vgdb.c and m_gdbserver/server.c. This removes code redundancies that was introduced for vgdb.c by vgdb --multi implementation.
Comment 1 Mark Wielaard 2023-12-08 13:32:08 UTC
Very nice. Hopefully we can share more utility functions in the future.
Since remote-utils-shared.c is based on some functions from remote-utils.c I have also copied the Copyright header from that file.

commit ec73dcb1826091b3cbdd43a4a37522e33c3ce786 (HEAD -> master, origin/master, origin/HEAD)
Author: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Date:   Wed Dec 6 03:14:53 2023 -0500

    remote-utils-shared: Created files for sharing code
    
    between vgdb.c and m_gdbserver/server.c. This removes code
    redundancies that was introduced for vgdb.c by vgdb --multi
    implementation.