Thread (161 messages) 161 messages, 8 authors, 2025-04-24

Re: [PATCH v4 19/39] unwind_user/sframe: Add support for reading .sframe contents

From: Josh Poimboeuf <jpoimboe@kernel.org>
Date: 2025-02-04 19:42:53
Also in: linux-perf-users, linux-toolchains, lkml

On Thu, Jan 30, 2025 at 07:51:15PM +0000, Weinan Liu wrote:
Nit: swap() might be a simplify way to alternate pointers between two
fre_addr[] entries.

For example,

static __always_inline int __find_fre(struct sframe_section *sec,
				      struct sframe_fde *fde, unsigned long ip,
				      struct unwind_user_frame *frame)
{
	/* intialize fres[] with invalid value */
	struct sframe_fre fres[2] = {0};
	struct sframe_fre *fre = &fres[1], *prev_fre = fres;

	for (i = 0; i < fde->fres_num; i++) {
		swap(fre, next_fre);
		ret = __read_fre(sec, fde, fre_addr, fre);
Problem is, if it breaks out early here on the first iteration:
		if (fre->ip_off > ip_off)
			break;
	}

	if (fre->size == 0)
		return -EINVAL;
Then fre isn't valid even though it has a nonzero size.

-- 
Josh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help