This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3] gdb: CTF support


On 2019-10-03 6:56 p.m., Weimin Pan wrote:
> [Changes from v2:
>  - Address Simon Marchi's comments, mainly:
>    * Use gdb::unique_xmalloc_ptr<> to minimize the manual memory management.
>    * Modify create_partial_symtab to handle multiple-CUs correctly.
>    * Improve defining/using ctf_context_t and field_info structs.
>    * Conform to GNU's coding standards.
> 
> This patch adds the CTF (Compact Ansi-C Type Format) support in gdb.
> Two submissions on which this gdb work depends were posted earlier
> in May:
> 
>  * On the binutils mailing list - adding libctf which creates, updates,
>    reads, and manipulates the CTF data.
>  * On the gcc mailing list - expanding gcc to directly emit the CFT data
>    with a new command line option -gt.
> 
> CTF is a reduced form of debugging information whose main purpose is to
> describe the type of C entities such as structures, unions, typedefs and
> function arguments at the global scope only. It does not contain debug
> information about source lines, location expressions, or local variables.
> For more information on CTF, see the documentation in the libdtrace-ctf
> source tree, available here:
> 
> <https://raw.githubusercontent.com/oracle/libdtrace-ctf/master/doc/ctf-format>.
> 
> This patch expands struct elfinfo by adding the .ctf section, which
> contains CTF debugging info, and modifies elf_symfile_read() to read it.
> If both DWARF and CTF exist in a program, only DWARF will be read. CTF data
> will be read only when there is no DWARF. The two-stage symbolic reading
> and setting strategy, partial and full, was used.
> 
> File ctfread.c contains functions to transform CTF data into gdb's internal
> symbol table structures by iterately reading entries from CTF sections
> of "data objects", "function info", "variable info", and "data types"
> when setting up either partial or full symbol table. If the ELF symbol table
> is available, e.g. not stripped, the CTF reader will associate the found
> type information with these symbol entries. Due to the proximity between DWARF
> and CTF (CTF being a much simplified subset of DWARF), some DWARF implementation
> was reused to support CTF.
> 
> Test cases ctf-constvars.exp, ctf-cvexpr.exp, ctf-ptype.exp, and ctf-whatis.exp
> have been added to verify the correctness of this support.
> 
> This patch has missing features and limitations which we will add and
> address in the future patches.

Hi Weimin,

1. Could you please split the renaming of ctf (the trace format) to tracectf to its
own patch, just before this patch (send them as a patch series)?  It will keep this
patch more focused on its main topic.

2. When applying the patch, git told me:

.git/rebase-apply/patch:1079: trailing whitespace.
	{
.git/rebase-apply/patch:1083: trailing whitespace.
	}
.git/rebase-apply/patch:1824: trailing whitespace.

.git/rebase-apply/patch:1889: trailing whitespace.

.git/rebase-apply/patch:1894: trailing whitespace.

Can you try to fix those?  One way of finding the offenders is to do "git show"
and look for trailing spaces by searching for `. $` in less.

3. I think the binutils patchset has been merged now?  Could you please rebase
on the latest master and force-push your users/weimin/ctf branch?

> gdb/ChangeLog
> +2019-10-03  Weimin Pan  <weimin.pan@oracle.com>
> +
> +	* gdb/ctfread.c: New file.
> +	* gdb/ctfread.h: New file.
> +	* gdb/elfread.c: Include ctfread.h.
> +	(struct elfinfo text_p): New member ctfsect.
> +	(elf_locate_sections): Mark CTF section.
> +	(elf_symfile_read): Call elfctf_build_psymtabs.
> +	* gdb/Makefile.in (LIBCTF): Add.
> +	(CLIBS): Use it.
> +	(CDEPS): Likewise.
> +	(DIST): Add ctfread.c.
> +	* gdb/tracectf.h: Rename, was gdb/ctf.h
> +	* gdb/ctf.c: Replace ctf.h with tracectf.h
> +	* gdb/tracefile.c: Likewise
> +	* gdb/tracepoint.c: Remove unused include ctf.h
> +	* gdb/mi/mi-main.c: Likewise

Drop all the gdb/ prefixes from this list, as we want all entries to be relative
to the ChangeLog file they appear in.

> +	* Makefile.def (dependencies): Add all-libctf to all-gdb
> +	* Makefile.in: Add "all-gdb: maybe-all-libctf"

Changes made to the top-level Makefile.def/Makefile.in will go in the top-level
ChangeLog.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]