History

Fix for lldb usage

lldb does not like function end and next function start at same pc

herman ten brugge committed 3 years ago

Commit 7cc1cc31 parent ab39d341 file · +6 −4Browse files

Unified · Split

tccdbg.c+6−4
@@ -971,7 +971,6 @@ ST_FUNC void tcc_debug_end(TCCState *s1) · 970 unmodified lines
971971 tcc_free(dwarf_line.filename_table[i].name);
972972 tcc_free(dwarf_line.filename_table);
973973
974− dwarf_line_op(s1, DW_LNS_negate_stmt);
975974 dwarf_line_op(s1, 0); // extended
976975 dwarf_uleb128_op(s1, 1); // extended size
977976 dwarf_line_op(s1, DW_LNE_end_sequence);
@@ -1828,9 +1827,6 @@ ST_FUNC void tcc_debug_funcstart(TCCState *s1, Sym *sym) · 850 unmodified lines
18281827
18291828 if (s1->dwarf) {
18301829 tcc_debug_line(s1);
1831− dwarf_line_op(s1, DW_LNS_negate_stmt);
1832− dwarf_line_op(s1, DW_LNS_copy);
1833− dwarf_line_op(s1, DW_LNS_negate_stmt);
18341830 dwarf_info.func = sym;
18351831 dwarf_info.line = file->line_num;
18361832 if (s1->do_backtrace) {
@@ -1868,9 +1864,15 @@ ST_FUNC void tcc_debug_prolog_epilog(TCCState *s1, int value) · 31 unmodified lines
18681864 /* put function size */
18691865 ST_FUNC void tcc_debug_funcend(TCCState *s1, int size)
18701866 {
1867+ /* lldb does not like function end and next function start at same pc */
1868+ int min_instr_len;
1869+
18711870 if (!s1->do_debug)
18721871 return;
1872+ min_instr_len = dwarf_line.last_pc == ind ? 0 : DWARF_MIN_INSTR_LEN;
1873+ ind -= min_instr_len;
18731874 tcc_debug_line(s1);
1875+ ind += min_instr_len;
18741876 tcc_debug_stabn(s1, N_RBRAC, size);
18751877 if (s1->dwarf) {
18761878 int func_sib = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t