disassemble_section

这篇文章展示了使用objdump工具进行二进制文件的反汇编过程,特别是针对PLT(ProcedureLinkageTable)部分的分析。在GDB调试环境中,查看了section对象的详细信息,包括名称、属性、VMA地址等,并对符号表中的符号进行了检查。内容涉及到动态链接和程序加载的相关知识。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


Breakpoint 1, disassemble_section (abfd=0x6555f0, section=0x6588f8, inf=0x7fffffffd8f0) at ./objdump.c:3668
3668	  unsigned int opb = pinfo->octets_per_byte;
(gdb) p *section
$11 = {name = 0x65985c ".plt", next = 0x65b838, prev = 0x6587c8, id = 28, section_id = 0, index = 12, flags = 283,
  user_set_vma = 1, linker_mark = 0, linker_has_input = 0, gc_mark = 0, compress_status = 0, segment_mark = 0,
  sec_info_type = 0, use_rela_p = 1, sec_flg0 = 0, sec_flg1 = 0, sec_flg2 = 0, sec_flg3 = 0, sec_flg4 = 0,
  sec_flg5 = 0, vma = 4198432, lma = 4198432, size = 32, rawsize = 0, compressed_size = 0, output_offset = 0,
  output_section = 0x0, relocation = 0x0, orelocation = 0x0, reloc_count = 0, alignment_power = 4, filepos = 4128,
  rel_filepos = 0, line_filepos = 0, userdata = 0x0, contents = 0x0, lineno = 0x0, lineno_count = 0, entsize = 0,
  kept_section = 0x0, moving_line_filepos = 0, target_index = 0, used_by_bfd = 0x65a978, constructor_chain = 0x0,
  owner = 0x6555f0, symbol = 0x65aa60, symbol_ptr_ptr = 0x6589e0, map_head = {link_order = 0x0, s = 0x0,
    linked_to_symbol_name = 0x0}, map_tail = {link_order = 0x0, s = 0x0, linked_to_symbol_name = 0x0},
  already_assigned = 0x0, type = 0}
(gdb) c
Continuing.

Disassembly of section .plt:

0000000000401020 <memset@plt-0x10>:
  401020:	ff 35 e2 2f 00 00    	push   0x2fe2(%rip)        # 404008 <_GLOBAL_OFFSET_TABLE_+0x8>
  401026:	ff 25 e4 2f 00 00    	jmp    *0x2fe4(%rip)        # 404010 <_GLOBAL_OFFSET_TABLE_+0x10>
  40102c:	0f 1f 40 00          	nopl   0x0(%rax)

0000000000401030 <memset@plt>:
  401030:	ff 25 e2 2f 00 00    	jmp    *0x2fe2(%rip)        # 404018 <memset@GLIBC_2.2.5>
  401036:	68 00 00 00 00       	push   $0x0
  40103b:	e9 e0 ff ff ff       	jmp    401020 <_init+0x20>


objdump_print_symname (abfd=0x6d95f0, inf=0x7fffffffd960, sym=0x6e43a0) at ./objdump.c:1283
1283	  const char *name, *version_string = NULL;
(gdb) n
1284	  bool hidden = false;
(gdb) p *sym
$34 = {the_bfd = 0x6d95f0, name = 0x6e43d0 "memset@plt", value = 16, flags = 2129930, section = 0x6dc8f8, udata = {
    p = 0x0, i = 0}}
(gdb) n
1286	  alloc = NULL;


3821	      addr = section->vma + addr_offset;
(gdb)
3822	      addr = ((addr & ((sign_adjust << 1) - 1)) ^ sign_adjust) - sign_adjust;
(gdb) p addr
$47 = 4198432 = (0x 0000000000401020)
(gdb) n
3824	      if (sym != NULL && bfd_asymbol_value (sym) <= addr)
(gdb) p addr
$49 = 4198432
(gdb) p section->vma
$50 = 4198432
(gdb) p b addr
No symbol "b" in current context.
(gdb) p sign_adjust
$51 = 0
(gdb) p addr
$3 = 4198432
(gdb) p section->vma
$4 = 4198432
(gdb) c
Continuing.

0000000000401020 <memset@plt-0x10>:
  401020:	ff 35 e2 2f 00 00    	push   0x2fe2(%rip)        # 404008 <_GLOBAL_OFFSET_TABLE_+0x8>
  401026:	ff 25 e4 2f 00 00    	jmp    *0x2fe4(%rip)        # 404010 <_GLOBAL_OFFSET_TABLE_+0x10>
  40102c:	0f 1f 40 00          	nopl   0x0(%rax)

0000000000401030 <memset@plt>:
  401030:	ff 25 e2 2f 00 00    	jmp    *0x2fe2(%rip)        # 404018 <memset@GLIBC_2.2.5>
  401036:	68 00 00 00 00       	push   $0x0
  40103b:	e9 e0 ff ff ff       	jmp    401020 <_init+0x20>
### Vue 3 和 TypeScript 中 Element Plus 的 `el-radio-group` 组件取消选中Vue 3 结合 TypeScript 使用 Element Plus 开发时,如果希望实现 `el-radio-group` 组件可以被取消选中的功能,则可以通过设置默认值为空或特定标记来达成此目的。通常情况下,`el-radio-group` 不允许直接取消选择已选项,但是通过绑定 v-model 到一个可变变量并控制该变量的状态即可间接达到效果。 为了使 radio group 支持取消选中,在模板部分定义好相应的 Radio Group 并将其 value 属性双向绑定到父级作用域内的数据属性上: ```html <template> <div class="example"> <!-- 定义Radio按钮组 --> <el-radio-group v-model="selectedValue" @change="handleChange"> <el-radio :label="1">Option A</el-radio> <el-radio :label="2">Option B</el-radio> </el-radio-group> <!-- 添加清除按钮用于重置选择状态 --> <button type="button" @click="clearSelection()">Clear Selection</button> </div> </template> ``` 接着是在脚本标签内声明组件逻辑以及初始化 selectedValue 数据项为 null 或者其他表示未选定状态的特殊值;同时提供 clearSelection 方法用来清空当前的选择: ```typescript <script lang="ts"> import { defineComponent, ref } from &#39;vue&#39;; export default defineComponent({ name: "Example", setup() { const selectedValue = ref<number | null>(null); // 初始化为null function handleChange(value: number): void { console.log(`Selected option changed to ${value}`); } function clearSelection():void{ selectedValue.value = null; } return { selectedValue, handleChange, clearSelection }; }, }); </script> ``` 上述代码展示了如何利用组合 API (Composition API) 来管理响应式的 selectedValue 变量,并且提供了清除所做选择的方法。当点击 Clear Selection 按钮时会触发 clearSelection 函数执行,进而将 selectedValue 设置成初始状态即 null[^1]。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值