Re: [PATCH v2] Improve corefile generation by using /proc/PID/coredump_filter (PR corefile/16902)

Pedro Alves
2015-03-18T19:10:29Z

On 03/16/2015 11:53 PM, Sergio Durigan Junior wrote:

> To summarize: I decided to change this part of the code, and make GDB
> actually ignore (i.e., return 0) mappings marked as UNMODIFIED. After
> all, as explained above, this is what Linux does.

I can't tell whether we'll still need the UNKNOWN state after that,
but offhand, if a mapping isn't supposed to be dumped, why not
just skip calling the callback (gcore_create_callback)?

>
>>
>>> +
>>> +foreach item $all_corefiles {
>>> + foreach name [list [lindex $item 3] [lindex $item 4]] {
>>> + set test "print/x $name"
>>> + gdb_test_multiple $test $test {
>>> + -re " = \($hex\)\r\n$gdb_prompt $" {
>>> + set addr($name) $expect_out(1,string)
>>
>> I'm probably being dense, but I can't see where is addr
>> ever used?
>
> 'addr' is an associative array that maps variable names to addresses.
> This is needed because sometimes (depending on which pags we
> dump/ignore), the stack is not dumped and GDB would not be able to find
> the variable names; therefore, this dependency is removed here.

Ah, it's used in do_load_and_test_core. Somehow missed that the first
time.

> I will not send the full patch again because I intend to split it into
> minor, more logical patches. I should be able to send it later
> today/tomorrow.

Thanks,
Pedro Alves