diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-04-07 08:06:50 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2022-04-12 14:13:10 -0400 |
commit | 71bc95ed2032567e2a7aebc3efe1c55a77abb7b2 (patch) | |
tree | df72666a77b98bda029327e1acfc5b2366ebe766 /gdb/xcoffread.c | |
parent | 30bf8e1ce4498467d62387b0d8a7009e3fbe2ab1 (diff) | |
download | gdb-71bc95ed2032567e2a7aebc3efe1c55a77abb7b2.zip gdb-71bc95ed2032567e2a7aebc3efe1c55a77abb7b2.tar.gz gdb-71bc95ed2032567e2a7aebc3efe1c55a77abb7b2.tar.bz2 |
gdb: allocate subfile with new
Allocate struct subfile with new, initialize its fields instead of
memset-ing it to 0. Use a unique_ptr for the window after a subfile has
been allocated but before it is linked in the buildsym_compunit's list
of subfile (and therefore owned by the buildsym_compunit.
I can't test the change in xcoffread.c, it's best-effort. I couldn't
find where subfiles are freed in that file, I assume they were
intentionally (or not) leaked.
Change-Id: Ib3b6877de31b7e65bc466682f08dbf5840225f24
Diffstat (limited to 'gdb/xcoffread.c')
-rw-r--r-- | gdb/xcoffread.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index c5d2d0a..296e713 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -632,8 +632,6 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) if (offset == 0) goto return_after_cleanup; - memset (&main_subfile, '\0', sizeof (main_subfile)); - if (inclIndx == 0) /* All source lines were in the main source file. None in include files. */ @@ -651,8 +649,6 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) for (ii = 0; ii < inclIndx; ++ii) { - struct subfile *tmpSubfile; - /* If there is main file source before include file, enter it. */ if (offset < inclTable[ii].begin) { @@ -675,14 +671,12 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) else { /* Have a new subfile for the include file. */ + inclTable[ii].subfile = new subfile; - tmpSubfile = inclTable[ii].subfile = XNEW (struct subfile); - - memset (tmpSubfile, '\0', sizeof (struct subfile)); firstLine = &(inclTable[ii].funStartLine); /* Enter include file's lines now. */ - enter_line_range (tmpSubfile, inclTable[ii].begin, + enter_line_range (inclTable[ii].subfile, inclTable[ii].begin, inclTable[ii].end, start, 0, firstLine); } |