diff mbox series

[3/4] dissect: change deanon() to handle the !node case

Message ID 20200204165142.GA24346@redhat.com (mailing list archive)
State Mainlined, archived
Headers show
Series dissect: minor fixes/cleanups | expand

Commit Message

Oleg Nesterov Feb. 4, 2020, 4:51 p.m. UTC
Change deanon() to always initialize base->ident when parent != NULL
but still return false to avoid the pointless ->r_symdef().

Test-case:

	struct {
		union {
			int x;
		};
	} var = {
		{ .x = 0 },
	};

before this patch:

	1:8   s def  :var
	5:3   g def  var                              struct :var
	5:3   g -w-  var                              struct :var
	6:12  s -w-  ?.x                              int

after:

	1:8   s def  :var
	5:3   g def  var                              struct :var
	5:3   g -w-  var                              struct :var
	6:12  s -w-  :var.x                           int

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 dissect.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/dissect.c b/dissect.c
index d34b38a..57dcdb2 100644
--- a/dissect.c
+++ b/dissect.c
@@ -195,8 +195,10 @@  static bool deanon(struct symbol *base, struct ident *node, struct symbol *paren
 	struct ident *pi = parent ? parent->ident : NULL;
 	char name[256];
 
-	if (!node)
+	if (!node) {
+		base->ident = pi;
 		return false;
+	}
 
 	snprintf(name, sizeof(name), "%.*s:%.*s",
 		pi ? pi->len : 0, pi ? pi->name : NULL, node->len, node->name);