[PATCH dwarves 2/3] pahole: add --skip_autodetect_btf_kind_max to disable kind autodetect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Autodetection of BTF kinds supported may not be wanted or may be
broken at some point; it is prudent to provide a way to switch it
off.

Suggested-by: Jiri Olsa <olsajiri@xxxxxxxxx>
Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
---
 btf_encoder.c      | 3 ++-
 dwarves.h          | 1 +
 man-pages/pahole.1 | 4 ++++
 pahole.c           | 8 ++++++++
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/btf_encoder.c b/btf_encoder.c
index 98c7529..ad0158f 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -1892,7 +1892,8 @@ struct btf *btf_encoder__btf(struct btf_encoder *encoder)
 
 void dwarves__set_btf_kind_max(struct conf_load *conf_load, int btf_kind_max)
 {
-	if (btf_kind_max < 0 || btf_kind_max >= BTF_KIND_MAX)
+	if (conf_load->skip_autodetect_btf_kind_max ||
+	    btf_kind_max < 0 || btf_kind_max >= BTF_KIND_MAX)
 		return;
 	if (btf_kind_max < BTF_KIND_DECL_TAG)
 		conf_load->skip_encoding_btf_decl_tag = true;
diff --git a/dwarves.h b/dwarves.h
index f4d9347..04a4c29 100644
--- a/dwarves.h
+++ b/dwarves.h
@@ -68,6 +68,7 @@ struct conf_load {
 	bool			skip_encoding_btf_enum64;
 	bool			btf_gen_optimized;
 	bool			skip_encoding_btf_inconsistent_proto;
+	bool			skip_autodetect_btf_kind_max;
 	uint8_t			hashtable_bits;
 	uint8_t			max_hashtable_bits;
 	uint16_t		kabi_prefix_len;
diff --git a/man-pages/pahole.1 b/man-pages/pahole.1
index c1b48de..523d4fd 100644
--- a/man-pages/pahole.1
+++ b/man-pages/pahole.1
@@ -233,6 +233,10 @@ Do not encode type tags in BTF.
 .B \-\-skip_encoding_btf_inconsistent_proto
 Do not encode functions with multiple inconsistent prototypes or unexpected register use for their parameters, where the registers used do not match calling conventions.
 
+.TP
+.B \-\-skip_autodetect_btf_kind_max
+Do not scan DWARF to find out which BTF kinds are supported by the underlying object.
+
 .TP
 .B \-j, \-\-jobs=N
 Run N jobs in parallel. Defaults to number of online processors + 10% (like
diff --git a/pahole.c b/pahole.c
index e843999..aca2704 100644
--- a/pahole.c
+++ b/pahole.c
@@ -1232,6 +1232,7 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;
 #define ARGP_skip_emitting_atomic_typedefs 338
 #define ARGP_btf_gen_optimized  339
 #define ARGP_skip_encoding_btf_inconsistent_proto 340
+#define ARGP_skip_autodetect_btf_kind_max 341
 
 static const struct argp_option pahole__options[] = {
 	{
@@ -1654,6 +1655,11 @@ static const struct argp_option pahole__options[] = {
 		.key = ARGP_skip_encoding_btf_inconsistent_proto,
 		.doc = "Skip functions that have multiple inconsistent function prototypes sharing the same name, or that use unexpected registers for parameter values."
 	},
+	{
+		.name = "skip_autodetect_btf_kind_max",
+		.key = ARGP_skip_autodetect_btf_kind_max,
+		.doc = "Skip auto-detection of maximum BTF kind supported."
+	},
 	{
 		.name = NULL,
 	}
@@ -1829,6 +1835,8 @@ static error_t pahole__options_parser(int key, char *arg,
 		conf_load.btf_gen_optimized = true;		break;
 	case ARGP_skip_encoding_btf_inconsistent_proto:
 		conf_load.skip_encoding_btf_inconsistent_proto = true; break;
+	case ARGP_skip_autodetect_btf_kind_max:
+		conf_load.skip_autodetect_btf_kind_max = true;	break;
 	default:
 		return ARGP_ERR_UNKNOWN;
 	}
-- 
2.39.3





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux