Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/offset/addr/ #21201

Open
trufae opened this issue Dec 26, 2022 · 1 comment
Open

s/offset/addr/ #21201

trufae opened this issue Dec 26, 2022 · 1 comment
Milestone

Comments

@trufae
Copy link
Collaborator

trufae commented Dec 26, 2022

The term offset is used in many places, when we can just use addr which is probably more correct. this may break ABI/API and json objects. but it's worth having it imho.

I expect some feedback and discussions on this change because it can break a bunch of scripts right now, but also it will make scripting more consistent

For example:

$ git grep '"offset' libr | grep '\.c:'
libr/anal/class.c:			pj_kn (j, "offset", base->offset);
libr/anal/class.c:			pj_kn (j, "offset", vtable->offset);
libr/anal/codemeta.c:			pj_ks (pj, "type", "offset");
libr/anal/codemeta.c:			pj_kn (pj, "offset", annotation->offset.offset);
libr/anal/codemeta.c:			pj_kn (pj, "offset", annotation->reference.offset);
libr/anal/codemeta.c:			pj_kn (pj, "offset", annotation->reference.offset);
libr/anal/codemeta.c:			pj_kn (pj, "offset", annotation->reference.offset);
libr/anal/meta.c:			pj_kn (pj, "offset", start);
libr/anal/p/anal_m68k_cs.c:			pj_ki (pj, "offset", op->mem.offset);
libr/anal/var.c:				pj_kN (pj, "offset", delta);
libr/anal/var.c:				pj_kN (pj, "offset", delta);
libr/anal/vtable.c:			pj_kN (pj, "offset", table->saddr);
libr/anal/vtable.c:				pj_kN (pj, "offset", curMethod->addr);
libr/arch/p/x86_nz/nzasm.c:				// RIP-relative LEA (not caught above, so "offset" is already relative)
libr/asm/arch/xtensa/gnu/xtensa-modules.c:  { "offset", 10, -1, 0, 0, 0, 0, 0, 0 },
libr/bin/bin.c:				pj_kN (pj, "offset", xtr_data->offset);
libr/bin/bin.c:	r_table_set_columnsf (table, fmt, "num", "offset", "size", "arch", "machine", NULL);
libr/bin/bin.c:			pj_kn (pj, "offset", boffset);
libr/bin/bin.c:				pj_kn (pj, "offset", boffset);
libr/bin/bin.c:				pj_kn (pj, "offset", boffset);
libr/bin/format/elf/elf.c:	sdb_num_set (sdb, "offset", shdr->sh_offset, 0);
libr/bin/format/elf/elf.c:	sdb_num_set (sdb, "offset", shdr->sh_offset, 0);
libr/bin/format/elf/elf.c:	sdb_num_set (sdb, "offset", shdr->sh_offset, 0);
libr/bin/format/pdb/pdb.c:					pj_kN (pj, "offset", offset);
libr/cons/pal.c:	{ "offset", r_offsetof (RConsPrintablePalette, offset), r_offsetof (RConsPalette, offset) },
libr/core/canal.c:					pj_ks (pj, "offset", record->type_offset);
libr/core/canal.c:			pj_kn (pj, "offset", bbi->addr);
libr/core/canal.c:				pj_kn (pj, "offset", op->addr);
libr/core/canal.c:					pj_kn (pj, "offset", case_op->addr);
libr/core/canal.c:		pj_kn (pj, "offset", fcn->addr);
libr/core/canal.c:	pj_kn (pj, "offset", fcn->addr);
libr/core/cbin.c:		const ut64 offset = sdb_num_get (sdb, "offset", 0);
libr/core/cbin.c:			pj_kn (pj, "offset", offset);
libr/core/cbin.c:		const ut64 offset = sdb_num_get (sdb, "offset", 0);
libr/core/cbin.c:			pj_kn (pj, "offset", offset);
libr/core/cmd.c:		pj_ki (pj, "offset", core->offset);
libr/core/cmd_anal.c:			pj_kn (pj, "offset", tgt_addr);
libr/core/cmd_anal.c:				pj_kn (pj, "offset", tgt_addr);
libr/core/cmd_anal.c:				pj_kn (pj, "offset", tgt_addr);
libr/core/cmd_anal.c:				pj_kn (pj, "offset", tgt_addr);
libr/core/cmd_anal.c:				pj_ki (pj, "offset", (int)(addr - fcn->addr));
libr/core/cmd_cmp.c:			pj_kn (pj, "offset", core->offset + i);
libr/core/cmd_debug.c:					pj_kn (pj, "offset", r->offset);
libr/core/cmd_debug.c:	r_table_add_column (t, typeNumber, "offset", 0);
libr/core/cmd_debug.c:				r_cons_printf ("offset = 0x%" PFMT64x "\n", t->addr);
libr/core/cmd_flag.c:						pj_kn (pj, "offset", item->offset);
libr/core/cmd_flag.c:						pj_kn (pj, "offset", f->offset);
libr/core/cmd_help.c:	"flag", "", "offset of flag",
libr/core/cmd_magic.c:			pj_kN (pj, "offset", addr + adelta);
libr/core/cmd_mount.c:				pj_kn (pj, "offset", root->delta);
libr/core/cmd_print.c:		r_table_set_columnsf (t, "sddddd", "offset", "flags", "funcs", "cmts", "syms", "str");
libr/core/cmd_print.c:				pj_kn (pj, "offset", at);
libr/core/cmd_print.c:		pj_kn (pj, "offset", core->offset);
libr/core/cmd_search.c:	"/E", " esil-expr", "offset matching given esil expressions $$ = here",
libr/core/cmd_search.c:			pj_kn (param->pj, "offset", base_addr + addr);
libr/core/cmd_search.c:			pj_kn (param->pj, "offset", base_addr + addr);
libr/core/cmd_search.c:			pj_kn (pj, "offset", hit->addr);
libr/core/cmd_search.c:		pj_kn (param->pj, "offset", hit->addr);
libr/core/cmd_search.c:		pj_kn (param->pj, "offset", from);
libr/core/cmd_seek.c:				pj_kn (pj, "offset", *addr);
libr/core/cmd_zign.c:			prefix = "offset";
libr/core/cmd_zign.c:		eprintf ("offset: %d\n", ctx->offset_count);
libr/core/core.c:			ADDARG ("offset");
libr/core/disasm.c:		pj_kn (ds->pj, "offset", ds->vat);
libr/core/disasm.c:			pj_kn (pj, "offset", at);
libr/core/disasm.c:		pj_kn (pj, "offset", at);
libr/core/panels.c:				"offset\n" \
libr/core/panels.c:				} else if (!strcmp (format, "offset")) {
libr/core/pseudo.c:						pj_kn (pj, "offset", addr);
libr/core/pseudo.c:						pj_ks (pj, "type", "offset");
libr/core/pseudo.c:				pj_kn (pj, "offset", addr);
libr/core/pseudo.c:				pj_ks (pj, "type", "offset");
libr/core/vmenus.c:				char *s = r_cons_input ("offset: ");
libr/core/vmenus.c:		r_cons_printf ("offset: 0x%08"PFMT64x"\n"Color_RESET, core->offset + cur);
libr/core/vmenus.c:				r_line_set_prompt ("offset: ");
libr/flag/flag.c:		pj_kn (u->pj, "offset", flag->offset);
libr/magic/apprentice.c:		file_magwarn (ms, "offset `%s' invalid", l);
libr/magic/apprentice.c:	 *	magwarn("offset too big"); }
libr/main/rafind2.c:		pj_kn (ro->pj, "offset", addr);
libr/main/rasm2.c:		printf ("offset:   0x%08" PFMT64x "\n", offset);
libr/util/asn1.c:		pj_kn (pj, "offset", obj->offset);
libr/util/bplist.c:		R_LOG_ERROR ("offset for node index %u points outside of valid range", node_index);
libr/util/bplist.c:		R_LOG_ERROR ("offset size in trailer must be larger than 0");
libr/util/bplist.c:		R_LOG_ERROR ("offset table offset points outside of valid range");
libr/util/bplist.c:		R_LOG_ERROR ("offset table points outside of valid range");
libr/util/format.c:				p->cb_printf ("[{\"index\":%d,\"offset\":%"PFMT64d"},", otimes-times, seek+i);
libr/util/format.c:				p->cb_printf ("\",\"offset\":%"PFMT64d",\"value\":",
libr/util/graph_drawable.c:			pj_kn (pj, "offset", print_node->offset);
libr/util/table.c:	r_table_set_columnsf (table, "sssssss", "No.", "offset", "blocks", "offset", "perms", "extra", "name");
libr/util/utype.c:		char *laddr = r_str_newf ("offset.%08"PFMT64x, addr);
@Lazula
Copy link
Collaborator

Lazula commented Mar 5, 2023

This looks like a good change, offset is a confusing term when it's just an addr and not an addr + something

@trufae trufae added this to the 5.9.0 milestone Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants