aboutsummaryrefslogtreecommitdiff
path: root/std/debug/index.zig
diff options
context:
space:
mode:
authorkristopher tate <kt@connectfree.co.jp>2018-06-21 00:40:21 +0900
committerkristopher tate <kt@connectfree.co.jp>2018-06-21 00:40:21 +0900
commit71db8df5480f4d849480267574cd5491066e3868 (patch)
tree1842ce3024d7254022c66d5a00c5e53488fcbeb8 /std/debug/index.zig
parent457c0f0a7e424177e7d8d00f4429da292b7c67d5 (diff)
downloadzig-71db8df5480f4d849480267574cd5491066e3868.tar.gz
zig-71db8df5480f4d849480267574cd5491066e3868.zip
std: update stdlib to match updated allocator create signature; ref #733
Diffstat (limited to 'std/debug/index.zig')
-rw-r--r--std/debug/index.zig17
1 files changed, 7 insertions, 10 deletions
diff --git a/std/debug/index.zig b/std/debug/index.zig
index 198e0f90f6..19cee3c65d 100644
--- a/std/debug/index.zig
+++ b/std/debug/index.zig
@@ -249,9 +249,7 @@ fn printSourceAtAddress(debug_info: *ElfStackTrace, out_stream: var, address: us
pub fn openSelfDebugInfo(allocator: *mem.Allocator) !*ElfStackTrace {
switch (builtin.object_format) {
builtin.ObjectFormat.elf => {
- const st = try allocator.create(ElfStackTrace);
- errdefer allocator.destroy(st);
- st.* = ElfStackTrace{
+ const st = try allocator.create(ElfStackTrace{
.self_exe_file = undefined,
.elf = undefined,
.debug_info = undefined,
@@ -261,7 +259,8 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) !*ElfStackTrace {
.debug_ranges = null,
.abbrev_table_list = ArrayList(AbbrevTableHeader).init(allocator),
.compile_unit_list = ArrayList(CompileUnit).init(allocator),
- };
+ });
+ errdefer allocator.destroy(st);
st.self_exe_file = try os.openSelfExe();
errdefer st.self_exe_file.close();
@@ -280,11 +279,10 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) !*ElfStackTrace {
var exe_file = try os.openSelfExe();
defer exe_file.close();
- const st = try allocator.create(ElfStackTrace);
+ const st = try allocator.create(ElfStackTrace{
+ .symbol_table = try macho.loadSymbols(allocator, &io.FileInStream.init(&exe_file))
+ });
errdefer allocator.destroy(st);
-
- st.* = ElfStackTrace{ .symbol_table = try macho.loadSymbols(allocator, &io.FileInStream.init(&exe_file)) };
-
return st;
},
builtin.ObjectFormat.coff => {
@@ -974,8 +972,7 @@ fn scanAllCompileUnits(st: *ElfStackTrace) !void {
try st.self_exe_file.seekTo(compile_unit_pos);
- const compile_unit_die = try st.allocator().create(Die);
- compile_unit_die.* = try parseDie(st, abbrev_table, is_64);
+ const compile_unit_die = try st.allocator().create( try parseDie(st, abbrev_table, is_64) );
if (compile_unit_die.tag_id != DW.TAG_compile_unit) return error.InvalidDebugInfo;