Skip to content

Commit 0f6f30c

Browse files
author
Petr Machata
committed
Nits
- Fix some coding style issues in output.c - Add a couple items to TODO
1 parent 5d3be33 commit 0f6f30c

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

TODO

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,10 @@
186186
GDB supports python pretty printers. We migh want to hook this in
187187
and use it to format certain types.
188188

189+
** support new Linux kernel features
190+
- PTRACE_SIEZE
191+
- /proc/PID/map_files/* (but only root seems to be able to read
192+
this as of now)
193+
189194
* BUGS
190195
** After a clone(), syscalls may be seen as sysrets in s390 (see trace.c:syscall_p())

output.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of ltrace.
3-
* Copyright (C) 2011,2012,2013 Petr Machata, Red Hat Inc.
3+
* Copyright (C) 2011,2012,2013,2014 Petr Machata, Red Hat Inc.
44
* Copyright (C) 2010 Joe Damato
55
* Copyright (C) 1997,1998,1999,2001,2002,2003,2004,2007,2008,2009 Juan Cespedes
66
* Copyright (C) 2006 Paul Gilliam, IBM Corporation
@@ -604,17 +604,17 @@ output_right(enum tof type, struct process *proc, struct library_symbol *libsym,
604604
/* Fetch & enter into dictionary the retval first, so that
605605
* other values can use it in expressions. */
606606
struct value retval;
607-
int own_retval = 0;
607+
bool own_retval = false;
608608
if (context != NULL) {
609609
value_init(&retval, proc, NULL, func->return_info, 0);
610-
own_retval = 1;
610+
own_retval = true;
611611
if (fetch_retval(context, type, proc, func->return_info,
612612
&retval) < 0)
613613
value_set_type(&retval, NULL, 0);
614614
else if (stel->arguments != NULL
615-
&& val_dict_push_named(stel->arguments, &retval,
616-
"retval", 0) == 0)
617-
own_retval = 0;
615+
&& val_dict_push_named(stel->arguments, &retval,
616+
"retval", 0) == 0)
617+
own_retval = false;
618618
}
619619

620620
if (stel->arguments != NULL)
@@ -662,11 +662,11 @@ output_right(enum tof type, struct process *proc, struct library_symbol *libsym,
662662
unw_init_remote(&cursor, proc->unwind_as, proc->unwind_priv);
663663
while (unwind_depth) {
664664

665-
own_retval = unw_get_reg(&cursor, UNW_REG_IP,
666-
(unw_word_t *) &ip);
667-
if (own_retval) {
665+
int rc = unw_get_reg(&cursor, UNW_REG_IP,
666+
(unw_word_t *) &ip);
667+
if (rc < 0) {
668668
fprintf(options.output, " > Error: %s\n",
669-
unw_strerror(own_retval));
669+
unw_strerror(rc));
670670
goto cont;
671671
}
672672

@@ -688,9 +688,10 @@ output_right(enum tof type, struct process *proc, struct library_symbol *libsym,
688688
lib = lib->next;
689689
}
690690

691-
own_retval = unw_get_proc_name(&cursor, fn_name, sizeof(fn_name),
692-
(unw_word_t *) &function_offset);
693-
if ((own_retval == 0) || (own_retval == -UNW_ENOMEM))
691+
rc = unw_get_proc_name(&cursor, fn_name,
692+
sizeof(fn_name),
693+
(unw_word_t *) &function_offset);
694+
if (rc == 0 || rc == -UNW_ENOMEM)
694695
fprintf(options.output, " > %s(%s+%p) [%p]\n",
695696
lib_name, fn_name, function_offset, ip);
696697
else

0 commit comments

Comments
 (0)