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

Fix various issues with dwarf emission: #7116

Merged
merged 14 commits into from Jun 28, 2021
Merged

Conversation

stuartarchibald
Copy link
Contributor

@stuartarchibald stuartarchibald commented Jun 14, 2021

  • Prevents the emission of DWARF information for alloca/zero init
    locations.
  • Fixes the DWARF location of variables arriving as arguments to
    the function.

Fixes #7103

vlad-perevezentsev and others added 2 commits June 14, 2021 17:10
* Prevents the emission of DWARF information for alloca/zero init
  locations.
* Fixes the DWARF location of variables arriving as arguments to
  the function.
@stuartarchibald
Copy link
Contributor Author

Demonstration of the behaviour with this patch:

$ cat issue7103.py 
import numba
import numpy as np

@numba.njit(debug=True)
def foo(a):
    b = a + 1
    c = a * 2.34
    d = (a, b, c)
    print(a, b, c, d)
    return b, c, d

r = foo(123)
lib = foo.overloads[foo.signatures[0]].library
with open(__file__.replace('.py','.elf'), 'wb') as f:
    f.write(lib._get_compiled_object())

$ gdb -q -ex 'b "issue7103.py:__main__::foo$241"' --args python issue7103.py
Reading symbols from python...
No source file named issue7103.py.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 ("issue7103.py:__main__::foo$241") pending.
(gdb) r
Starting program: <path>/python issue7103.py

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[Detaching after fork from child process 23895]
[Detaching after fork from child process 23896]
[Detaching after fork from child process 23897]
[New Thread 0x7fffe9fb0700 (LWP 23898)]
[New Thread 0x7fffe97af700 (LWP 23899)]
[New Thread 0x7fffd8fae700 (LWP 23900)]

Thread 1 "python" hit Breakpoint 1, __main__::foo$241 () at issue7103.py:4
4       @numba.njit(debug=True)
(gdb) l
1       import numba
2       import numpy as np
3
4       @numba.njit(debug=True)
5       def foo(a):
6           b = a + 1
7           c = a * 2.34
8           d = (a, b, c)
9           print(a, b, c, d)
10          return b, c, d
(gdb) info locals
d = "0/lUUU\000\000\025\260iUUU\000\000\000\000\000\000\000\000\000"
a = <optimized out>
b = <optimized out>
c = <optimized out>
(gdb) n
6           b = a + 1
(gdb) info locals
d = '\000' <repeats 23 times>
a = 123
b = 0
c = 0
(gdb) n
7           c = a * 2.34
(gdb) info locals
d = '\000' <repeats 23 times>
a = 123
b = <optimized out>
c = 0
(gdb) n
8           d = (a, b, c)
(gdb) info locals
d = '\000' <repeats 23 times>
a = 123
b = 124
c = 287.81999999999999
(gdb) n
9           print(a, b, c, d)
(gdb) info locals
d = "{\000\000\000\000\000\000\000|\000\000\000\000\000\000\000\205\353Q\270\036\375q@"
a = 123
b = 124
c = 287.81999999999999
(gdb) n
123 124 287.82 (123, 124, 287.82)
10          return b, c, d
(gdb) info locals
d = "{\000\000\000\000\000\000\000|\000\000\000\000\000\000\000\205\353Q\270\036\375q@"
a = 0
b = 124
c = 287.81999999999999
(gdb) n
PyTuple_New (size=3) at <path>/Objects/tupleobject.c:81
81      <path>/Objects/tupleobject.c: No such file or directory.
(gdb) c
Continuing.
123 124 287.82 (123, 124, 287.82)
[Thread 0x7fffe97af700 (LWP 23917) exited]
[Thread 0x7fffe9fb0700 (LWP 23916) exited]
[Thread 0x7fffd8fae700 (LWP 23918) exited]
[Inferior 1 (process 23909) exited normally]

looking at the line info:

$ llvm-dwarfdump -debug-line issue7103.elf 
issue7103.elf:  file format ELF64-x86-64

.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x0000005e
         version: 4
 prologue_length: 0x00000024
 min_inst_length: 1
max_ops_per_inst: 1
 default_is_stmt: 1
       line_base: -5
      line_range: 14
     opcode_base: 13
standard_opcode_lengths[DW_LNS_copy] = 0
standard_opcode_lengths[DW_LNS_advance_pc] = 1
standard_opcode_lengths[DW_LNS_advance_line] = 1
standard_opcode_lengths[DW_LNS_set_file] = 1
standard_opcode_lengths[DW_LNS_set_column] = 1
standard_opcode_lengths[DW_LNS_negate_stmt] = 0
standard_opcode_lengths[DW_LNS_set_basic_block] = 0
standard_opcode_lengths[DW_LNS_const_add_pc] = 0
standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
standard_opcode_lengths[DW_LNS_set_isa] = 1
file_names[  1]:
           name: "issue7103.py"
      dir_index: 0
       mod_time: 0x00000000
         length: 0x00000000

Address            Line   Column File   ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x0000000000000000      4      0      1   0             0  is_stmt
0x00000000000000e3      6      1      1   0             0  is_stmt prologue_end
0x00000000000000f6      0      1      1   0             0 
0x00000000000000fe      7      1      1   0             0  is_stmt
0x000000000000011e      8      1      1   0             0  is_stmt
0x0000000000000137      9      1      1   0             0  is_stmt
0x000000000000018e      0      1      1   0             0 
0x00000000000001b0      9      1      1   0             0 
0x00000000000006e4     10      1      1   0             0  is_stmt
0x0000000000000f7e     10      1      1   0             0  is_stmt end_sequence

compared to #7103 (comment), the "jumps" have gone as the entry block now isn't referenced in the DWARF.

@stuartarchibald
Copy link
Contributor Author

This PR also contains #7074.

@stuartarchibald
Copy link
Contributor Author

Suggestions about how to test this are welcomed. Possibilities include:

  • LNS entries in the forward assembly from LLVM.
  • Execute programs under Numba's gdb support to check stepping etc.
  • Check the LLVM-IR.
  • Use objdump --dwarf=decodedline to check line numbers.
  • Something else?

@stuartarchibald stuartarchibald added this to the Numba 0.54 RC milestone Jun 14, 2021
@stuartarchibald
Copy link
Contributor Author

Test suite is currently failing (bf19801) on build py38_np118_typeguard with the seemingly unrelated:

2021-06-15T15:47:12.6360927Z 9415 tests found. 9415 selected
2021-06-15T15:47:12.6361224Z 
2021-06-15T15:47:12.6361597Z # Now run the Numba test suite with slicing
2021-06-15T15:47:12.6362092Z # Note that coverage is run from the checkout dir to match the "source"
2021-06-15T15:47:12.6362545Z # directive in .coveragerc
2021-06-15T15:47:12.6363062Z echo "INFO: Running slice of discovered tests: ($TEST_START_INDEX,None,$TEST_COUNT)"
2021-06-15T15:47:12.6363576Z if [ "$RUN_COVERAGE" == "yes" ]; then
2021-06-15T15:47:12.6364005Z     export PYTHONPATH=.
2021-06-15T15:47:12.6364387Z     coverage erase
2021-06-15T15:47:12.6365781Z     $SEGVCATCH coverage run runtests.py -b -j "$TEST_START_INDEX,None,$TEST_COUNT" --exclude-tags='long_running' -m $TEST_NPROCS -- numba.tests
2021-06-15T15:47:12.6366660Z elif [ "$RUN_TYPEGUARD" == "yes" ]; then
2021-06-15T15:47:12.6367137Z     echo "INFO: Running with typeguard"
2021-06-15T15:47:12.6368375Z     NUMBA_USE_TYPEGUARD=1 NUMBA_ENABLE_CUDASIM=1 PYTHONWARNINGS="ignore:::typeguard" $SEGVCATCH python runtests.py -b -j "$TEST_START_INDEX,None,$TEST_COUNT" --exclude-tags='long_running' -m $TEST_NPROCS -- numba.tests
2021-06-15T15:47:12.6369185Z else
2021-06-15T15:47:12.6370124Z     NUMBA_ENABLE_CUDASIM=1 $SEGVCATCH python -m numba.runtests -b -j "$TEST_START_INDEX,None,$TEST_COUNT" --exclude-tags='long_running' -m $TEST_NPROCS -- numba.tests
2021-06-15T15:47:12.6370789Z fi
2021-06-15T15:47:12.6371246Z INFO: Running slice of discovered tests: (13,None,19)
2021-06-15T15:47:12.6371734Z INFO: Running with typeguard
2021-06-15T15:47:21.5192465Z skipped HSA tests
2021-06-15T15:47:21.5193251Z skipped HSA tests
2021-06-15T15:47:21.5193765Z Parallel: 470. Serial: 80
2021-06-15T15:48:33.2613584Z .......................................................................................................................................................................................OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
2021-06-15T15:48:34.1328216Z ......OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
2021-06-15T15:49:03.8587828Z ...........ssssssssssssssssss................s.............................................................................................................................................................................................................................................ss...ss............sssss.ss..s..ss..s...sss..OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
2021-06-15T15:49:20.9047131Z .....Fs...............sssssssssss
2021-06-15T15:49:20.9048615Z ======================================================================
2021-06-15T15:49:20.9049589Z FAIL: test_no_collision (numba.tests.test_dispatcher.TestCacheFileCollision)
2021-06-15T15:49:20.9051190Z ----------------------------------------------------------------------
2021-06-15T15:49:20.9052079Z Traceback (most recent call last):
2021-06-15T15:49:20.9053521Z   File "/home/vsts/work/1/s/numba/tests/test_dispatcher.py", line 1664, in test_no_collision
2021-06-15T15:49:20.9054829Z     self.assertEqual(cachelog.count('index saved'), 1)
2021-06-15T15:49:20.9055640Z AssertionError: 0 != 1
2021-06-15T15:49:20.9056146Z 
2021-06-15T15:49:20.9057183Z ----------------------------------------------------------------------
2021-06-15T15:49:20.9058329Z Ran 550 tests in 119.389s
2021-06-15T15:49:20.9058826Z 
2021-06-15T15:49:20.9059492Z FAILED (failures=1, skipped=49)
2021-06-15T15:49:21.5614825Z ##[error]Bash exited with code '1'.
2021-06-15T15:49:21.5631841Z ##[section]Finishing: Test

Comment on lines +1312 to +1316
# If it's an arg set the location as the function definition line
if name in self.func_ir.arg_names:
loc = self.loc.with_lineno(self.func_ir.loc.line)
else:
loc = self.loc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't see anything that tests this. Do you think the following addition is a reasonable test?

diff --git a/numba/tests/test_debuginfo.py b/numba/tests/test_debuginfo.py
index 7a1aae08f..e9d2fc410 100644
--- a/numba/tests/test_debuginfo.py
+++ b/numba/tests/test_debuginfo.py
@@ -182,6 +182,16 @@ class TestDebugInfoEmission(TestCase):
             dilocation_info = metadata_definition_map[k]
             self.assertIn(f'line: {line_no}', dilocation_info)
 
+        # Check that the line number of the argument `a` is the line number
+        # that the function begins on
+        line_re = re.compile(r'.*!DILocalVariable\(name: "a",.*line: ([0-9]*),')
+        for line in metadata:
+            matched = line_re.match(line)
+            if matched:
+                g = matched.groups()
+                self.assertEqual(len(g), 1)
+                self.assertEqual(int(g[0]), pysrc_line_start)
+
 
 if __name__ == '__main__':
     unittest.main()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good point, I'll add something to this effect.

@gmarkall
Copy link
Member

I'm not seeing quite the same behaviour with the example above:

$ gdb -q -ex 'b "repro.py:__main__::foo$241"' --args python repro.py
Reading symbols from python...done.
No source file named repro.py.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 ("repro.py:__main__::foo$241") pending.
(gdb) run
Starting program: /home/gmarkall/miniconda3/envs/numbanp120/bin/python repro.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, __main__::foo$241 () at repro.py:4
4	@numba.njit(debug=True)
(gdb) list
1	import numba
2	import numpy as np
3	
4	@numba.njit(debug=True)
5	def foo(a):
6	    b = a + 1
7	    c = a * 2.34
8	    d = (a, b, c)
9	    print(a, b, c, d)
10	    return b, c, d
(gdb) info locals
d = <optimised out>
c = <optimised out>
b = <optimised out>
a = <optimised out>
(gdb) n
9	    print(a, b, c, d)
(gdb) info locals
d = "{", '\000' <repeats 22 times>
c = <optimised out>
b = <optimised out>
a = 123
(gdb) n
123 124 287.82 (123, 124, 287.82)
10	    return b, c, d
(gdb) info locals
d = '\000' <repeats 23 times>
c = 0
b = 0
a = 0
(gdb) n
0x00007ffff7e6553f in cpython::__main__::foo$241(long long) ()
(gdb) info locals
No symbol table info available.

@gmarkall
Copy link
Member

Line info from the ELF:

$ llvm-dwarfdump -debug-line repro.elf 
repro.elf:	file format ELF64-x86-64

.debug_line contents:
debug_line[0x00000000]
Line table prologue:
    total_length: 0x0000006b
         version: 4
 prologue_length: 0x00000020
 min_inst_length: 1
max_ops_per_inst: 1
 default_is_stmt: 1
       line_base: -5
      line_range: 14
     opcode_base: 13
standard_opcode_lengths[DW_LNS_copy] = 0
standard_opcode_lengths[DW_LNS_advance_pc] = 1
standard_opcode_lengths[DW_LNS_advance_line] = 1
standard_opcode_lengths[DW_LNS_set_file] = 1
standard_opcode_lengths[DW_LNS_set_column] = 1
standard_opcode_lengths[DW_LNS_negate_stmt] = 0
standard_opcode_lengths[DW_LNS_set_basic_block] = 0
standard_opcode_lengths[DW_LNS_const_add_pc] = 0
standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
standard_opcode_lengths[DW_LNS_set_isa] = 1
file_names[  1]:
           name: "repro.py"
      dir_index: 0
       mod_time: 0x00000000
         length: 0x00000000

Address            Line   Column File   ISA Discriminator Flags
------------------ ------ ------ ------ --- ------------- -------------
0x0000000000000000      4      0      1   0             0  is_stmt
0x000000000000001f      9      1      1   0             0  is_stmt prologue_end
0x0000000000000044      0      1      1   0             0 
0x0000000000000049      9      1      1   0             0 
0x00000000000000e2      0      1      1   0             0 
0x00000000000000e6      9      1      1   0             0 
0x0000000000000174      0      1      1   0             0 
0x0000000000000187      9      1      1   0             0 
0x0000000000000306     10      1      1   0             0  is_stmt
0x0000000000000325      0      0      1   0             0 
0x0000000000000334      9      1      1   0             0  is_stmt
0x00000000000008cb      9      1      1   0             0  is_stmt end_sequence

... perhaps I'm doing something wrong / stupid here.

@stuartarchibald
Copy link
Contributor Author

I'm not seeing quite the same behaviour with the example above:

$ gdb -q -ex 'b "repro.py:__main__::foo$241"' --args python repro.py
Reading symbols from python...done.
No source file named repro.py.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 ("repro.py:__main__::foo$241") pending.
(gdb) run
Starting program: /home/gmarkall/miniconda3/envs/numbanp120/bin/python repro.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, __main__::foo$241 () at repro.py:4
4	@numba.njit(debug=True)
(gdb) list
1	import numba
2	import numpy as np
3	
4	@numba.njit(debug=True)
5	def foo(a):
6	    b = a + 1
7	    c = a * 2.34
8	    d = (a, b, c)
9	    print(a, b, c, d)
10	    return b, c, d
(gdb) info locals
d = <optimised out>
c = <optimised out>
b = <optimised out>
a = <optimised out>
(gdb) n
9	    print(a, b, c, d)
(gdb) info locals
d = "{", '\000' <repeats 22 times>
c = <optimised out>
b = <optimised out>
a = 123
(gdb) n
123 124 287.82 (123, 124, 287.82)
10	    return b, c, d
(gdb) info locals
d = '\000' <repeats 23 times>
c = 0
b = 0
a = 0
(gdb) n
0x00007ffff7e6553f in cpython::__main__::foo$241(long long) ()
(gdb) info locals
No symbol table info available.

Did you set NUMBA_OPT=0? It looks the above is perhaps at O3? (apologies if this is the case, the reproducer #7116 (comment) should have stated this).

@gmarkall
Copy link
Member

Did you set NUMBA_OPT=0? It looks the above is perhaps at O3? (apologies if this is the case, the reproducer #7116 (comment) should have stated this).

Thanks, that was it - I assumed you were at -O3 because the docs somewhere state that running with -O0 causes weirdness when debugging - but maybe this is the fix for that weirdness?

@gmarkall
Copy link
Member

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@stuartarchibald
Copy link
Contributor Author

Did you set NUMBA_OPT=0? It looks the above is perhaps at O3? (apologies if this is the case, the reproducer #7116 (comment) should have stated this).

Thanks, that was it - I assumed you were at -O3 because the docs somewhere state that running with -O0 causes weirdness when debugging - but maybe this is the fix for that weirdness?

This? https://numba.readthedocs.io/en/stable/user/troubleshoot.html#debugging-jit-compiled-code-with-gdb I think this patch fixes the second point under "known issues" with stepping (jumpy source location). I'll remove both that statement and the remark for O1 as that is just a side effect of the alloca getting optimised out (probably by SROA) and then the erroneous debug metadata disappearing with it.

Copy link
Member

@gmarkall gmarkall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks generally good to me and behaves as you suggest it should (when NUMBA_OPT is set to 0! :-) )

The location and language tests that are added look sane to me.

What do you think about the additional test for the argument locations? It would be good to have some test of them - is there one that exists already that I missed?

As discussed out-of-band, an alternative might be to set the debug location of the alloca and store to the first source line of the function (which will coincide with the @njit decorator line in most cases), which might help prevent them showing as <optimized out> when the breakpoint is first hit, but I think there's no need to experiment with this or make changes for this PR - it could be a potential improvement in future.

numba/core/cgutils.py Outdated Show resolved Hide resolved
@gmarkall
Copy link
Member

The test did work for me locally, but now I've kicked off the test again to see if the typeguard problem was transient, I'm a little surprised by the new fails:

FAIL: test_DILocation (numba.tests.test_debuginfo.TestDebugInfoEmission)
Tests that DILocation information is reasonable.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vsts/work/1/s/numba/tests/test_debuginfo.py", line 183, in test_DILocation
    self.assertIn(f'line: {line_no}', dilocation_info)
AssertionError: 'line: 92' not found in '!DILocation(line: 95, column: 1, scope: !4)'

@stuartarchibald
Copy link
Contributor Author

The test did work for me locally, but now I've kicked off the test again to see if the typeguard problem was transient, I'm a little surprised by the new fails:

FAIL: test_DILocation (numba.tests.test_debuginfo.TestDebugInfoEmission)
Tests that DILocation information is reasonable.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vsts/work/1/s/numba/tests/test_debuginfo.py", line 183, in test_DILocation
    self.assertIn(f'line: {line_no}', dilocation_info)
AssertionError: 'line: 92' not found in '!DILocation(line: 95, column: 1, scope: !4)'

It's #6720 causing the problems.

@stuartarchibald
Copy link
Contributor Author

Patches fc5859b..7bb2960 fix issues with ed5183e and how to test it.

Copy link
Member

@gmarkall gmarkall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good - lifetime of the variables is looking better with the recent commits:

$ NUMBA_OPT=0 gdb -q -ex 'b "repro.py:__main__::foo$241"' --args python repro.py 
Reading symbols from python...done.
No source file named repro.py.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 ("repro.py:__main__::foo$241") pending.
(gdb) run
Starting program: /home/gmarkall/miniconda3/envs/numbanp120/bin/python repro.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, __main__::foo$241 () at repro.py:4
4	@numba.njit(debug=True)
(gdb) l
1	import numba
2	import numpy as np
3	
4	@numba.njit(debug=True)
5	def foo(a):
6	    b = a + 1
7	    c = a * 2.34
8	    d = (a, b, c)
9	    print(a, b, c, d)
10	    return b, c, d
(gdb) info locals
a = 140736910562592
b = 93824993559743
c = 6.9533272545908306e-310
d = " \225\217\335\377\177\000\000\374\016\324\335\377\177\000\000\000\021\220\335\377\177\000"
(gdb) n
6	    b = a + 1
(gdb) info locals
a = 0
b = 0
c = 0
d = '\000' <repeats 23 times>
(gdb) n
7	    c = a * 2.34
(gdb) info locals
a = 123
b = 124
c = 0
d = '\000' <repeats 23 times>
(gdb) n
8	    d = (a, b, c)
(gdb) info locals
a = 123
b = 124
c = 287.81999999999999
d = '\000' <repeats 23 times>
(gdb) n
9	    print(a, b, c, d)
(gdb) info locals
a = 123
b = 124
c = 287.81999999999999
d = "{\000\000\000\000\000\000\000|\000\000\000\000\000\000\000\205\353Q\270\036\375q@"
(gdb) n
123 124 287.82 (123, 124, 287.82)
10	    return b, c, d
(gdb) info locals
a = 0
b = 124
c = 287.81999999999999
d = "{\000\000\000\000\000\000\000|\000\000\000\000\000\000\000\205\353Q\270\036\375q@"

In summary:

  • The life of locals seems to last throughout the lifetime of the block
  • The exception is the argument a which doesn't yet appear initialized when breaking on the function (it shows up as 0 when the breakpoint is hit), and also seems to get clobbered on the last line of the function. (I don't think this is an issue to try to fix in this PR, which already makes a great improvement).

There are a couple of small comments on the diff, but otherwise I think this is looking good.

Comment on lines 222 to 225
the entry block has no debug metadata associated with it. In practice,
if this is not the case, it manifests as the prologue_end being
associated with the end_sequence or similar (due to the way code gen
works for the entry block)."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think when you say "In practice, if this is not the case", the meaning is "In practice, if debug metadata is associated with it" - is that understanding correct? If so, could the comment state that explicitly? If not, what does the original phrase mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c0d9ee8

if name not in self._singly_assigned_vars:
# If the name is used in multiple blocks or lowering with debuginfo...
flags = utils.ConfigStack.top_or_none()
if (name not in self._singly_assigned_vars) or flags.debuginfo:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's about 6 checks for debug info added in this file - whilst its clear at the time of this review that these are all added to disable the SROA-like optimization in debug mode, I think later down the line looking at these functions in isolation it might not be all that clear why these conditions include flags.debuginfo or not flags.debuginfo - is there a way to replace the use of this flag at each site with a variable that makes it clear what its reason is - e.g. named disable_sroa_like_opt (or something more apt, I'm presently lacking in imagination)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, fixed in 8329107

@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review labels Jun 25, 2021
Copy link
Member

@gmarkall gmarkall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates - this is looking good!

@stuartarchibald
Copy link
Contributor Author

Thanks for the updates - this is looking good!

Thanks for the review @gmarkall

@sklam sklam added 5 - Ready to merge Review and testing done, is ready to merge and removed 4 - Waiting on author Waiting for author to respond to review labels Jun 28, 2021
@sklam sklam merged commit e7db1d9 into numba:master Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to merge Review and testing done, is ready to merge Effort - medium Medium size effort needed highpriority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GDB doesn't show the values of variables when it hits breakpoint the first time
5 participants